diff --git a/lib/plugins/db/RolePersistence.class.php b/lib/plugins/db/RolePersistence.class.php
index 60b0b6507f7a5f74eb6a3c954fc3b7d13e1b5e50..d24c2a6298f1479090d06f9f1ee5844fb2610681 100644
--- a/lib/plugins/db/RolePersistence.class.php
+++ b/lib/plugins/db/RolePersistence.class.php
@@ -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);