From 2758bc055da69e0a96555cdca9293814ca7ccce5 Mon Sep 17 00:00:00 2001 From: kremsy Date: Sun, 25 May 2014 10:06:22 +0200 Subject: [PATCH] sets for permission levels --- .../core/Admin/AuthenticationManager.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/application/core/Admin/AuthenticationManager.php b/application/core/Admin/AuthenticationManager.php index 81ed3df0..85386926 100644 --- a/application/core/Admin/AuthenticationManager.php +++ b/application/core/Admin/AuthenticationManager.php @@ -326,6 +326,26 @@ class AuthenticationManager implements CallbackListener { * @param int $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("-"); } }