|
|
@@ -2286,36 +2286,41 @@ class SiteController extends ActionController
|
|
|
$this->getBaseBeGroupUid(self::BEGROUP_ADMIN_PREMIUM)
|
|
|
];
|
|
|
|
|
|
- $editorsGroupUid = $this->findEditorsBeGroupUid($rootUid);
|
|
|
+ $adminUid = null;
|
|
|
|
|
|
- $queryBuilder = $this->connectionPool->getQueryBuilderForTable('be_users');
|
|
|
- if (!$withRestrictions) {
|
|
|
- $queryBuilder->getRestrictions()->removeAll();
|
|
|
- }
|
|
|
- $beUsers = $queryBuilder
|
|
|
- ->select('uid', 'usergroup')
|
|
|
- ->from('be_users')
|
|
|
- ->where('FIND_IN_SET(' . $rootUid . ', db_mountpoints) > 0')
|
|
|
- ->execute()
|
|
|
- ->fetchAll();
|
|
|
+ try {
|
|
|
+ $editorsGroupUid = $this->findEditorsBeGroupUid($rootUid);
|
|
|
|
|
|
- $adminUid = null;
|
|
|
- foreach ($beUsers as $beUser) {
|
|
|
- // the admin shall be both in the website editors group and in the Admin group
|
|
|
- $isAdmin = false;
|
|
|
- $isInThisWebsiteGroup = false;
|
|
|
- foreach (explode(',', $beUser['usergroup']) as $group) {
|
|
|
- if (in_array($group, $adminGroups)) {
|
|
|
- $isAdmin = true;
|
|
|
- }
|
|
|
- if ($group == $editorsGroupUid) {
|
|
|
- $isInThisWebsiteGroup = true;
|
|
|
- }
|
|
|
+ $queryBuilder = $this->connectionPool->getQueryBuilderForTable('be_users');
|
|
|
+ if (!$withRestrictions) {
|
|
|
+ $queryBuilder->getRestrictions()->removeAll();
|
|
|
}
|
|
|
+ $beUsers = $queryBuilder
|
|
|
+ ->select('uid', 'usergroup')
|
|
|
+ ->from('be_users')
|
|
|
+ ->where('FIND_IN_SET(' . $rootUid . ', db_mountpoints) > 0')
|
|
|
+ ->execute()
|
|
|
+ ->fetchAll();
|
|
|
+
|
|
|
+ foreach ($beUsers as $beUser) {
|
|
|
+ // the admin shall be both in the website editors group and in the Admin group
|
|
|
+ $isAdmin = false;
|
|
|
+ $isInThisWebsiteGroup = false;
|
|
|
+ foreach (explode(',', $beUser['usergroup']) as $group) {
|
|
|
+ if (in_array($group, $adminGroups)) {
|
|
|
+ $isAdmin = true;
|
|
|
+ }
|
|
|
+ if ($group == $editorsGroupUid) {
|
|
|
+ $isInThisWebsiteGroup = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if ($isAdmin && $isInThisWebsiteGroup) {
|
|
|
- $adminUid = $beUser['uid'];
|
|
|
+ if ($isAdmin && $isInThisWebsiteGroup) {
|
|
|
+ $adminUid = $beUser['uid'];
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (NoSuchRecordException $e) {
|
|
|
+ // the editors group does not exist
|
|
|
}
|
|
|
|
|
|
// Try to find if there is a be_user who still is in the v8.7 architecture
|