Good Morning Users,
I have a range of methods over various classes which depend on a user having permissions.
I’m thinking of doing the following
[code]
$myObj->thisMethod($User, $Vars);
Then within the method, check the the user class to see if the user passed in has permissions for the method being called.
[code]
public function thisMethod($User, $Vars){
if ($User->checkPermission(2) !== true){
return ‘You do not have permission to do this’;
exit();
}
}
Where the number 2 is unique to this method.
My question or concern is I can’t see 100’s of different permission levels. I’ll need to enable/disable individual users from each of them.
Each function/permission will be stored in a DB which is where the unique ID is coming from.
Is this as simple as entering the function into my DB getting the ID and coding it into each function it applies to.
Very manual.
Any centralized or automatic ways of doing this? – or any general improvements are welcome.