|
@@ -2233,7 +2233,7 @@ class SiteController extends ActionController
|
|
|
* for this website
|
|
* for this website
|
|
|
*
|
|
*
|
|
|
* @param int $rootUid
|
|
* @param int $rootUid
|
|
|
- * @param bool $withRestrictions
|
|
|
|
|
|
|
+ * @param bool $withRestrictions If false, the default restrictions won't apply, meaning this could return a deleted record
|
|
|
* @return int
|
|
* @return int
|
|
|
* @throws NoSuchRecordException
|
|
* @throws NoSuchRecordException
|
|
|
*/
|
|
*/
|
|
@@ -2251,7 +2251,6 @@ class SiteController extends ActionController
|
|
|
->select('uid', 'subgroup')
|
|
->select('uid', 'subgroup')
|
|
|
->from('be_groups')
|
|
->from('be_groups')
|
|
|
->where('FIND_IN_SET(' . $rootUid . ', db_mountpoints) > 0')
|
|
->where('FIND_IN_SET(' . $rootUid . ', db_mountpoints) > 0')
|
|
|
-// ->andWhere($queryBuilder->expr()->eq('deleted', 0))
|
|
|
|
|
->execute()
|
|
->execute()
|
|
|
->fetchAll();
|
|
->fetchAll();
|
|
|
|
|
|
|
@@ -2276,8 +2275,10 @@ class SiteController extends ActionController
|
|
|
* for this website
|
|
* for this website
|
|
|
*
|
|
*
|
|
|
* @param int $rootUid
|
|
* @param int $rootUid
|
|
|
|
|
+ * @param bool $withRestrictions If false, the default restrictions won't apply, meaning this could return a deleted record
|
|
|
* @return int
|
|
* @return int
|
|
|
* @throws NoSuchRecordException
|
|
* @throws NoSuchRecordException
|
|
|
|
|
+ * @throws NoSuchWebsiteException
|
|
|
*/
|
|
*/
|
|
|
protected function findAdminBeUserUid(int $rootUid, bool $withRestrictions=true): int {
|
|
protected function findAdminBeUserUid(int $rootUid, bool $withRestrictions=true): int {
|
|
|
$adminGroups = [
|
|
$adminGroups = [
|
|
@@ -2295,7 +2296,6 @@ class SiteController extends ActionController
|
|
|
->select('uid', 'usergroup')
|
|
->select('uid', 'usergroup')
|
|
|
->from('be_users')
|
|
->from('be_users')
|
|
|
->where('FIND_IN_SET(' . $rootUid . ', db_mountpoints) > 0')
|
|
->where('FIND_IN_SET(' . $rootUid . ', db_mountpoints) > 0')
|
|
|
-// ->andWhere($queryBuilder->expr()->eq('deleted', 0))
|
|
|
|
|
->execute()
|
|
->execute()
|
|
|
->fetchAll();
|
|
->fetchAll();
|
|
|
|
|
|
|
@@ -2326,14 +2326,20 @@ class SiteController extends ActionController
|
|
|
$expectedUsername = $extraData['admin']['username'];
|
|
$expectedUsername = $extraData['admin']['username'];
|
|
|
|
|
|
|
|
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('be_users');
|
|
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('be_users');
|
|
|
- $adminUid = $queryBuilder
|
|
|
|
|
- ->select('uid')
|
|
|
|
|
|
|
+ if (!$withRestrictions) {
|
|
|
|
|
+ $queryBuilder->getRestrictions()->removeAll();
|
|
|
|
|
+ }
|
|
|
|
|
+ $row = $queryBuilder
|
|
|
|
|
+ ->select('uid', 'db_mountpoints')
|
|
|
->from('be_users')
|
|
->from('be_users')
|
|
|
->where($queryBuilder->expr()->eq('username', $queryBuilder->expr()->literal($expectedUsername)))
|
|
->where($queryBuilder->expr()->eq('username', $queryBuilder->expr()->literal($expectedUsername)))
|
|
|
- ->andWhere($queryBuilder->expr()->eq('db_mountpoints', $rootUid))
|
|
|
|
|
- ->andWhere($queryBuilder->expr()->eq('deleted', 0))
|
|
|
|
|
->execute()
|
|
->execute()
|
|
|
- ->fetchColumn(0);
|
|
|
|
|
|
|
+ ->fetch();
|
|
|
|
|
+
|
|
|
|
|
+ if ((string)$rootUid != (string)$row['db_mountpoints']) {
|
|
|
|
|
+ throw new \RuntimeException("The be_user named '" . $expectedUsername . "' has unexpected mounted website(s)");
|
|
|
|
|
+ }
|
|
|
|
|
+ $adminUid = $row['uid'];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if ($adminUid == null) {
|
|
if ($adminUid == null) {
|