Skip to content

Commit

Permalink
Fixing minor issue with role inheritance testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Krulis committed Sep 16, 2019
1 parent d0ff13d commit 93297b3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/V1Module/security/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ protected function addRole(string $role, array $parents) {

/**
* Verify whether given actual role has at least the permissions of minimal requested role.
* In other words, this function is basicaly a check that $actualTestedRole >= $minimalRequestedRole
* in the terms of role strenghth (more permissive is bigger).
* @param string $actualTestedRole
* @param string $minimalRequestedRole
*/
public function isInRole(string $actualTestedRole, string $minimalRequestedRole): bool {
if ($actualTestedRole === self::SUPERADMIN_ROLE) {
return true; // special case -- superadmin takes it all...
}

if ($actualTestedRole === $minimalRequestedRole) {
return true;
}
Expand Down

0 comments on commit 93297b3

Please sign in to comment.