aboutsummaryrefslogtreecommitdiffstats
path: root/settings/Controller/AdminSettingsController.php
diff options
context:
space:
mode:
Diffstat (limited to 'settings/Controller/AdminSettingsController.php')
-rw-r--r--settings/Controller/AdminSettingsController.php30
1 files changed, 21 insertions, 9 deletions
diff --git a/settings/Controller/AdminSettingsController.php b/settings/Controller/AdminSettingsController.php
index e2ad577024c..e322a2a5354 100644
--- a/settings/Controller/AdminSettingsController.php
+++ b/settings/Controller/AdminSettingsController.php
@@ -27,8 +27,12 @@ namespace OC\Settings\Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\Group\ISubAdmin;
+use OCP\IGroupManager;
use OCP\INavigationManager;
use OCP\IRequest;
+use OCP\IUser;
+use OCP\IUserSession;
use OCP\Settings\IManager as ISettingsManager;
use OCP\Template;
@@ -38,21 +42,21 @@ use OCP\Template;
class AdminSettingsController extends Controller {
use CommonSettingsTrait;
- /**
- * @param string $appName
- * @param IRequest $request
- * @param INavigationManager $navigationManager
- * @param ISettingsManager $settingsManager
- */
public function __construct(
$appName,
IRequest $request,
INavigationManager $navigationManager,
- ISettingsManager $settingsManager
+ ISettingsManager $settingsManager,
+ IUserSession $userSession,
+ IGroupManager $groupManager,
+ ISubAdmin $subAdmin
) {
parent::__construct($appName, $request);
$this->navigationManager = $navigationManager;
$this->settingsManager = $settingsManager;
+ $this->userSession = $userSession;
+ $this->groupManager = $groupManager;
+ $this->subAdmin = $subAdmin;
}
/**
@@ -60,6 +64,7 @@ class AdminSettingsController extends Controller {
* @return TemplateResponse
*
* @NoCSRFRequired
+ * @SubAdminRequired
*/
public function index($section) {
return $this->getIndexResponse('admin', $section);
@@ -70,9 +75,16 @@ class AdminSettingsController extends Controller {
* @return array
*/
protected function getSettings($section) {
- $settings = $this->settingsManager->getAdminSettings($section);
+ /** @var IUser $user */
+ $user = $this->userSession->getUser();
+ $isSubAdmin = !$this->groupManager->isAdmin($user->getUID()) && $this->subAdmin->isSubAdmin($user);
+ $settings = $this->settingsManager->getAdminSettings(
+ $section,
+ $isSubAdmin
+ );
$formatted = $this->formatSettings($settings);
- if($section === 'additional') {
+ // Do not show legacy forms for sub admins
+ if($section === 'additional' && !$isSubAdmin) {
$formatted['content'] .= $this->getLegacyForms();
}
return $formatted;