aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaus-Justus Heine <himself@claus-justus-heine.de>2022-01-30 22:27:56 +0100
committerClaus-Justus Heine <himself@claus-justus-heine.de>2022-01-31 14:08:49 +0100
commita234217bb78c97f94c6bc04c9c2665b0e8d90540 (patch)
treeaa4acdd0c0c482693e0362d0eb03fb98273e2171
parent764e452ef6980c344617e6ad2214763e9781d0b7 (diff)
downloadnextcloud-server-a234217bb78c97f94c6bc04c9c2665b0e8d90540.tar.gz
nextcloud-server-a234217bb78c97f94c6bc04c9c2665b0e8d90540.zip
Allow sub-admins to access delegated settings.
Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
-rw-r--r--lib/private/Settings/Manager.php25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php
index ebda3fe021d..84fbf9426b0 100644
--- a/lib/private/Settings/Manager.php
+++ b/lib/private/Settings/Manager.php
@@ -335,23 +335,20 @@ class Manager implements IManager {
public function getAllowedAdminSettings(string $section, IUser $user): array {
$isAdmin = $this->groupManager->isAdmin($user->getUID());
- $isSubAdmin = $this->subAdmin->isSubAdmin($user);
- $subAdminOnly = !$isAdmin && $isSubAdmin;
-
- if ($subAdminOnly) {
- // not an admin => look if the user is still authorized to access some
- // settings
- $subAdminSettingsFilter = function (ISettings $settings) {
- return $settings instanceof ISubAdminSettings;
- };
- $appSettings = $this->getSettings('admin', $section, $subAdminSettingsFilter);
- } elseif ($isAdmin) {
+ if ($isAdmin) {
$appSettings = $this->getSettings('admin', $section);
} else {
$authorizedSettingsClasses = $this->mapper->findAllClassesForUser($user);
- $authorizedGroupFilter = function (ISettings $settings) use ($authorizedSettingsClasses) {
- return in_array(get_class($settings), $authorizedSettingsClasses) === true;
- };
+ if ($this->subAdmin->isSubAdmin($user)) {
+ $authorizedGroupFilter = function (ISettings $settings) use ($authorizedSettingsClasses) {
+ return $settings instanceof ISubAdminSettings
+ || in_array(get_class($settings), $authorizedSettingsClasses) === true;
+ };
+ } else {
+ $authorizedGroupFilter = function (ISettings $settings) use ($authorizedSettingsClasses) {
+ return in_array(get_class($settings), $authorizedSettingsClasses) === true;
+ };
+ }
$appSettings = $this->getSettings('admin', $section, $authorizedGroupFilter);
}