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
$cache = self::getUserRolesCache();
if (!isset($cache[$user_id])) {
$query = "SELECT DISTINCT *
FROM (
SELECT `roleid`, `institut_id`, 1 AS explicit
FROM `roles_user`
WHERE `userid` = :user_id
UNION
SELECT `roleid`, '' AS institut_id, 0 AS explicit
FROM `roles_studipperms`
WHERE `permname` = :perm
) AS tmp";
$query = "SELECT `roleid`, `institut_id`, 1 AS explicit
FROM `roles_user`
WHERE `userid` = :user_id
UNION ALL
SELECT `roleid`, '' AS institut_id, 0 AS explicit
FROM `roles_studipperms`
WHERE `permname` = :perm";
$statement = DBManager::get()->prepare($query);
$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->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