I am working on a user-role / permission system in PHP for a script.
Below is a code using a bitmask method for permissions that I found on phpbuilder.com.
B
I guess the first example gives you more control of exactly what permissions a user has. In the second you just have a user 'level'; presumably higher levels inherit all the permissions granted to a lower 'level' user, so you don't have such fine control.
Also, if I have understood correctly, the line
if($user_permission_level === 4)
means that only users with exactly permission level 4 have access to the action - surely you would want to check that users have at least that level?