summaryrefslogtreecommitdiffstats
path: root/inc/user.inc.php
diff options
context:
space:
mode:
authorUdo Walter2017-04-25 14:50:37 +0200
committerUdo Walter2017-04-25 14:50:37 +0200
commit3e4c27599f920e6f630f048f494f5d196fc81b8e (patch)
tree77c61e2867f26fbbfe928266d433652a3248053e /inc/user.inc.php
parentMerge branches 'master' and 'permission-manager' of git.openslx.org:openslx-n... (diff)
downloadslx-admin-3e4c27599f920e6f630f048f494f5d196fc81b8e.tar.gz
slx-admin-3e4c27599f920e6f630f048f494f5d196fc81b8e.tar.xz
slx-admin-3e4c27599f920e6f630f048f494f5d196fc81b8e.zip
[permissionmanager] added possibility to get a list of allowed locations for a given permission + bugfixes
Diffstat (limited to 'inc/user.inc.php')
-rw-r--r--inc/user.inc.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/inc/user.inc.php b/inc/user.inc.php
index 3606f025..13e56cd3 100644
--- a/inc/user.inc.php
+++ b/inc/user.inc.php
@@ -30,15 +30,24 @@ class User
{
if (!self::isLoggedIn())
return false;
- if (Module::get("permissionmanager")) {
- require_once "modules/permissionmanager/inc/permissionutil.inc.php";
- $module = Request::get("do", false);
- $permission = $module ? $module.".".$permission : $permission;
+ if (Module::isAvailable("permissionmanager")) {
+ $module = Page::getModule();
+ $permission = $module ? $module->getIdentifier().".".$permission : $permission;
return PermissionUtil::userHasPermission(self::$user['userid'], $permission, $locationid);
}
return (self::$user['permissions'] & (Permission::get($permission) | Permission::get('superadmin'))) != 0;
}
+ public static function getAllowedLocations($permission)
+ {
+ if (Module::isAvailable("permissionmanager")) {
+ $module = Page::getModule();
+ $permission = $module ? $module->getIdentifier().".".$permission : $permission;
+ return PermissionUtil::getAllowedLocations(self::$user['userid'], $permission);
+ }
+ return array();
+ }
+
public static function load()
{
if (self::isLoggedIn())