diff options
author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-09-01 21:47:05 +0200 |
---|---|---|
committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-09-01 21:47:05 +0200 |
commit | 8749c99e3453012d5fc8be199ed5a725e447b511 (patch) | |
tree | 2c201364621ce31eaca9bde4e6c481ac485b4617 | |
parent | 4979d98aa939aa01262c9ea7795677d4c196387c (diff) | |
parent | af246483e2feb0a8fbfb81782da17fb5f8dda957 (diff) | |
download | forums-8749c99e3453012d5fc8be199ed5a725e447b511.tar forums-8749c99e3453012d5fc8be199ed5a725e447b511.tar.gz forums-8749c99e3453012d5fc8be199ed5a725e447b511.tar.bz2 forums-8749c99e3453012d5fc8be199ed5a725e447b511.tar.xz forums-8749c99e3453012d5fc8be199ed5a725e447b511.zip |
Merge pull request #3765 from Zoddo/ticket/13950
[ticket/13950] Hide undefined permissions
* Zoddo/ticket/13950:
[ticket/13950] Hide undefined categories
[ticket/13950] Hide undefined permissions
-rw-r--r-- | phpBB/includes/acp/auth.php | 10 | ||||
-rw-r--r-- | phpBB/phpbb/permissions.php | 22 |
2 files changed, 32 insertions, 0 deletions
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 905e981cdc..52c45499b2 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -1113,6 +1113,11 @@ class auth_admin extends \phpbb\auth\auth @reset($category_array); while (list($cat, $cat_array) = each($category_array)) { + if (!$phpbb_permissions->category_defined($cat)) + { + continue; + } + $template->assign_block_vars($tpl_cat, array( 'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false, 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, @@ -1139,6 +1144,11 @@ class auth_admin extends \phpbb\auth\auth @reset($cat_array['permissions']); while (list($permission, $allowed) = each($cat_array['permissions'])) { + if (!$phpbb_permissions->permission_defined($permission)) + { + continue; + } + if ($s_view) { $template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array( diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php index 82f59b5c20..42bbe443d1 100644 --- a/phpBB/phpbb/permissions.php +++ b/phpBB/phpbb/permissions.php @@ -160,6 +160,28 @@ class permissions } /** + * Checks if a category has been defined + * + * @param string $category Identifier of the category + * @return bool True if the category is defined, false otherwise + */ + public function category_defined($category) + { + return isset($this->categories[$category]); + } + + /** + * Checks if a permission has been defined + * + * @param string $permission Identifier of the permission + * @return bool True if the permission is defined, false otherwise + */ + public function permission_defined($permission) + { + return isset($this->permissions[$permission]); + } + + /** * Returns the language string of a permission * * @param string $permission Identifier of the permission |