navigationManager = $navigationManager; $this->settingsManager = $settingsManager; $this->userSession = $userSession; $this->groupManager = $groupManager; $this->subAdmin = $subAdmin; $this->declarativeSettingsManager = $declarativeSettingsManager; $this->initialState = $initialState; } /** * @NoCSRFRequired * @NoAdminRequired * @NoSubAdminRequired * We are checking the permissions in the getSettings method. If there is no allowed * settings for the given section. The user will be gretted by an error message. */ public function index(string $section): TemplateResponse { return $this->getIndexResponse('admin', $section); } /** * @param string $section * @return array */ protected function getSettings($section) { /** @var IUser $user */ $user = $this->userSession->getUser(); $isSubAdmin = !$this->groupManager->isAdmin($user->getUID()) && $this->subAdmin->isSubAdmin($user); $settings = $this->settingsManager->getAllowedAdminSettings($section, $user); $declarativeFormIDs = $this->declarativeSettingsManager->getFormIDs($user, 'admin', $section); if (empty($settings) && empty($declarativeFormIDs)) { throw new NotAdminException("Logged in user doesn't have permission to access these settings."); } $formatted = $this->formatSettings($settings); // Do not show legacy forms for sub admins if ($section === 'additional' && !$isSubAdmin) { $formatted['content'] .= $this->getLegacyForms(); } return $formatted; } /** * @return bool|string */ private function getLegacyForms() { $forms = \OC_App::getForms('admin'); $forms = array_map(function ($form) { if (preg_match('%(