sets for permission levels
This commit is contained in:
parent
0146a5f4f1
commit
2758bc055d
@ -326,6 +326,26 @@ class AuthenticationManager implements CallbackListener {
|
|||||||
* @param int $authLevelNeeded
|
* @param int $authLevelNeeded
|
||||||
*/
|
*/
|
||||||
public function definePermissionLevel($rightName, $authLevelNeeded) {
|
public function definePermissionLevel($rightName, $authLevelNeeded) {
|
||||||
$this->maniaControl->settingManager->initSetting($this, $rightName, $authLevelNeeded);
|
$this->maniaControl->settingManager->initSetting($this, $rightName, $this->getPermissionLevelNameArray($authLevelNeeded));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the PermissionLevelNameArray
|
||||||
|
*
|
||||||
|
* @param $authLevelNeeded
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getPermissionLevelNameArray($authLevelNeeded) {
|
||||||
|
switch ($authLevelNeeded) {
|
||||||
|
case self::AUTH_LEVEL_MODERATOR:
|
||||||
|
return array(self::AUTH_NAME_MODERATOR, self::AUTH_NAME_ADMIN, self::AUTH_NAME_SUPERADMIN, self::AUTH_NAME_MASTERADMIN);
|
||||||
|
case self::AUTH_LEVEL_ADMIN:
|
||||||
|
return array(self::AUTH_NAME_ADMIN, self::AUTH_NAME_SUPERADMIN, self::AUTH_NAME_MASTERADMIN, self::AUTH_NAME_MODERATOR);
|
||||||
|
case self::AUTH_LEVEL_SUPERADMIN:
|
||||||
|
return array(self::AUTH_NAME_SUPERADMIN, self::AUTH_NAME_MASTERADMIN, self::AUTH_NAME_MODERATOR, self::AUTH_NAME_ADMIN);
|
||||||
|
case self::AUTH_LEVEL_MASTERADMIN:
|
||||||
|
return array(self::AUTH_NAME_MASTERADMIN, self::AUTH_NAME_MODERATOR, self::AUTH_NAME_ADMIN, self::AUTH_NAME_SUPERADMIN);
|
||||||
|
}
|
||||||
|
return array("-");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user