Skip to content
Snippets Groups Projects
Commit df3965cd authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fix role loading for nobody, fixes #1209

Closes #1209

Merge request studip/studip!718
parent 7ae6beef
No related branches found
No related tags found
No related merge requests found
...@@ -221,21 +221,18 @@ class RolePersistence ...@@ -221,21 +221,18 @@ class RolePersistence
$cache = self::getUserRolesCache(); $cache = self::getUserRolesCache();
if (!isset($cache[$user_id])) { if (!isset($cache[$user_id])) {
$query = "SELECT DISTINCT * $query = "SELECT `roleid`, `institut_id`, 1 AS explicit
FROM ( FROM `roles_user`
SELECT `roleid`, `institut_id`, 1 AS explicit WHERE `userid` = :user_id
FROM `roles_user`
WHERE `userid` = :user_id UNION ALL
UNION SELECT `roleid`, '' AS institut_id, 0 AS explicit
FROM `roles_studipperms`
SELECT `roleid`, '' AS institut_id, 0 AS explicit WHERE `permname` = :perm";
FROM `roles_studipperms`
WHERE `permname` = :perm
) AS tmp";
$statement = DBManager::get()->prepare($query); $statement = DBManager::get()->prepare($query);
$statement->bindValue(':user_id', $user_id); $statement->bindValue(':user_id', $user_id);
$statement->bindValue(':perm', $GLOBALS['perm']->get_perm($user_id)); $statement->bindValue(':perm', is_object($GLOBALS['perm']) ? $GLOBALS['perm']->get_perm($user_id) : 'nobody');
$statement->execute(); $statement->execute();
$statement->setFetchMode(PDO::FETCH_ASSOC); $statement->setFetchMode(PDO::FETCH_ASSOC);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment