diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 47b175acf..ac754409a 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -5,7 +5,6 @@ use OCA\Circles\Service\ConfigService; use OCA\Circles\Service\MiscService; use OCP\AppFramework\Controller; -use OCP\AppFramework\Http\TemplateResponse; use OCP\IRequest; @@ -26,15 +25,6 @@ public function __construct( } - /** - * @NoCSRFRequired - * @return TemplateResponse - */ - public function admin() { - return new TemplateResponse($this->appName, 'settings.admin', [], 'blank'); - } - - /** * @NoCSRFRequired */ @@ -49,7 +39,7 @@ public function getSettings() { 'allowFederatedCircles' => $this->configService->getAppValue( ConfigService::CIRCLES_ALLOW_FEDERATED_CIRCLES ), - 'skipInvitationStep' => $this->configService->getAppValue( + 'skipInvitationStep' => $this->configService->getAppValue( ConfigService::CIRCLES_SKIP_INVITATION_STEP ) ]; @@ -58,7 +48,9 @@ public function getSettings() { } - public function setSettings($members_limit, $allow_linked_groups, $allow_federated_circles, $skip_invitation_to_closed_circles) { + public function setSettings( + $members_limit, $allow_linked_groups, $allow_federated_circles, $skip_invitation_to_closed_circles + ) { $this->configService->setAppValue( ConfigService::CIRCLES_MEMBERS_LIMIT, $members_limit ); @@ -75,4 +67,4 @@ public function setSettings($members_limit, $allow_linked_groups, $allow_federat return $this->getSettings(); } -} \ No newline at end of file +} diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index ab872c24e..b052d4656 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -156,11 +156,13 @@ public function isCircleAllowed($type) { /** * @return bool + * @throws GSStatusException */ public function isLinkedGroupsAllowed() { if ($this->allowedLinkedGroups === -1) { - $this->allowedLinkedGroups = - (int)$this->getAppValue(self::CIRCLES_ALLOW_LINKED_GROUPS); + $allowed = ($this->getAppValue(self::CIRCLES_ALLOW_LINKED_GROUPS) === '1' + && !$this->getGSStatus(self::GS_ENABLED)); + $this->allowedLinkedGroups = ($allowed) ? 1 : 0; } return ($this->allowedLinkedGroups === 1); diff --git a/lib/Settings/CirclesSettings.php b/lib/Settings/CirclesSettings.php index 7664f16f0..42bec6ffa 100644 --- a/lib/Settings/CirclesSettings.php +++ b/lib/Settings/CirclesSettings.php @@ -21,33 +21,53 @@ * */ + namespace OCA\Circles\Settings; + +use OCA\Circles\Exceptions\GSStatusException; +use OCA\Circles\Service\ConfigService; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use OCP\Settings\ISettings; + class CirclesSettings implements ISettings { + /** @var IConfig */ private $config; + /** @var ConfigService */ + private $configService; + + /** * CirclesSettings constructor. * * @param IConfig $config + * @param ConfigService $configService */ - public function __construct(IConfig $config) { + public function __construct(IConfig $config, ConfigService $configService) { $this->config = $config; + $this->configService = $configService; } + /** * @return TemplateResponse + * @throws GSStatusException */ public function getForm() { - return new TemplateResponse('circles', 'settings.admin'); + return new TemplateResponse( + 'circles', 'settings.admin', + [ + 'gsEnabled' => $this->configService->getGSStatus(ConfigService::GS_ENABLED) + ] + ); } + /** * @return string */ @@ -55,10 +75,13 @@ public function getSection() { return 'groupware'; } + /** * @return int */ public function getPriority() { return 90; } + } + diff --git a/templates/settings.admin.php b/templates/settings.admin.php index b7985c78b..265bd354d 100644 --- a/templates/settings.admin.php +++ b/templates/settings.admin.php @@ -15,11 +15,17 @@

+

t('Groups can be linked to circles.')); ?>

+