Return the highest role for a project when a user is member of multiple groups
This commit is contained in:
@@ -86,6 +86,26 @@ class AccessMap
|
||||
return $roles;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user