<p class="first-paragraph">Most of us don’t need a robust permission handling in our application. What do we mean under simple role management? Basically that, you have a team, the team has an owner and some members.</p>
<p class="second-paragraph">We want to determine who is the owner, who has a bit more rights in the team and who is a basic member with the basic permissions.</p>
<div>
<p class="third-paragraph">In code, that means we have a User model, a Team model and a pivot table that establishes the connection between the two models.</p>
<p>Since, most of the time this structure is present, it’s time to roll out a simple solution for handling roles that stored in the pivot table.</p>
</div>
:root {
box-sizing: border-box;
}
*,
::before,
::after {
box-sizing: inherit;
}
body {
font-family: 'Lato', sans-serif;
padding: 40px;
font-size: 120%;
line-height: 1.5;
color: #565656;
}
p {
position: relative;
margin: 20px 0;
// margin-top display helper
&::before {
content: 'margin-top';
color: rgba(0,0,0,0.4);
font-size: 14px;
position: absolute;
top: -20px;
right: 0;
left: 0;
background: rgba(167, 63, 188, 0.2);
display: block;
height: 20px;
line-height: 20px;
padding: 0 10px;
}
// margin-bottom display helper
&::after {
content: 'margin-bottom';
color: rgba(0,0,0,0.4);
font-size: 14px;
position: absolute;
bottom: -20px;
right: 0;
left: 0;
background: rgba(63, 188, 162, 0.3);
display: block;
height: 20px;
line-height: 20px;
padding: 0 10px;
text-align: right;
}
}
.first-paragraph {
margin-bottom: 40px;
// margin-bottom display helper
&::after {
height: 40px;
line-height: 40px;
bottom: -40px;
}
}
.second-paragraph {
margin-top: 30px;
// margin-top display helper
&::before {
height: 30px;
line-height: 30px;
top: -30px;
}
}
.third-paragraph {
margin-top: 60px;
// margin-top display helper
&::before {
height: 60px;
line-height: 60px;
top: -60px;
}
}
div {
background: rgba(255, 255, 0, 0.15);
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.