mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
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
This commit is contained in:
commit
8749c99e34
2 changed files with 32 additions and 0 deletions
|
@ -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(
|
||||
|
|
|
@ -159,6 +159,28 @@ class permissions
|
|||
return (isset($this->permissions[$permission]['cat'])) ? $this->permissions[$permission]['cat'] : 'misc';
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue