From fadc375c510693a87a2e1acb090605bbeed52fe4 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 14 Feb 2018 14:15:05 +0100 Subject: Global: Only show "Warning" badge at the top if user can view event log, also hide warnings on the main page from modules the user has no access to --- inc/permission.inc.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'inc/permission.inc.php') diff --git a/inc/permission.inc.php b/inc/permission.inc.php index cd41e986..d6977e32 100644 --- a/inc/permission.inc.php +++ b/inc/permission.inc.php @@ -19,7 +19,7 @@ class Permission // TODO: Doc/Refactor public static function addGlobalTags(&$array, $locationid, $disabled, $noneAvailDisabled = null) { - if (!Module::isAvailable('permissionmanager')) + if (Module::get('permissionmanager') === false) return; $one = false; foreach ($disabled as $perm) { @@ -44,5 +44,12 @@ class Permission } } + public static function moduleHasPermissions($moduleId) + { + if (Module::get('permissionmanager') === false) + return true; + return file_exists('modules/' . $moduleId . '/permissions/permissions.json'); + } + } -- cgit v1.2.3-55-g7522