diff options
Diffstat (limited to 'app/Core/Security/AccessMap.php')
-rw-r--r-- | app/Core/Security/AccessMap.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/Core/Security/AccessMap.php b/app/Core/Security/AccessMap.php index 02a4ca45..f34c4b00 100644 --- a/app/Core/Security/AccessMap.php +++ b/app/Core/Security/AccessMap.php @@ -87,6 +87,26 @@ class AccessMap } /** + * Get the highest role from a list + * + * @access public + * @param array $roles + * @return string + */ + public function getHighestRole(array $roles) + { + $rank = array(); + + foreach ($roles as $role) { + $rank[$role] = count($this->getRoleHierarchy($role)); + } + + asort($rank); + + return key($rank); + } + + /** * Add new access rules * * @access public |