aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2021-10-14 15:07:14 +0200
committerCarl Schwan <carl@carlschwan.eu>2021-10-15 18:41:00 +0200
commit719dbafd1339702a170f04ebbc4f20e80d45e8c9 (patch)
tree0e4648b4f770e7c0f7b1ebad33afc718f63fdd8d /apps/dav/lib
parentb585cf1ea1baeb7bbfaf22953e48bbd33e8381fa (diff)
downloadnextcloud-server-719dbafd1339702a170f04ebbc4f20e80d45e8c9.tar.gz
nextcloud-server-719dbafd1339702a170f04ebbc4f20e80d45e8c9.zip
Add support for Delegation Settings for more apps
* This adds support for the sharing, groupware, theming and user_ldap app * This adds some code who disapeared during a rebase in the initial delegation PR (provisioning_api) Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/Controller/BirthdayCalendarController.php2
-rw-r--r--apps/dav/lib/Settings/CalDAVSettings.php29
2 files changed, 22 insertions, 9 deletions
diff --git a/apps/dav/lib/Controller/BirthdayCalendarController.php b/apps/dav/lib/Controller/BirthdayCalendarController.php
index addcc4dd20a..4305d6daaef 100644
--- a/apps/dav/lib/Controller/BirthdayCalendarController.php
+++ b/apps/dav/lib/Controller/BirthdayCalendarController.php
@@ -88,6 +88,7 @@ class BirthdayCalendarController extends Controller {
/**
* @return Response
+ * @AuthorizedAdminSetting(settings=OCA\DAV\Settings\CalDAVSettings)
*/
public function enable() {
$this->config->setAppValue($this->appName, 'generateBirthdayCalendar', 'yes');
@@ -104,6 +105,7 @@ class BirthdayCalendarController extends Controller {
/**
* @return Response
+ * @AuthorizedAdminSetting(settings=OCA\DAV\Settings\CalDAVSettings)
*/
public function disable() {
$this->config->setAppValue($this->appName, 'generateBirthdayCalendar', 'no');
diff --git a/apps/dav/lib/Settings/CalDAVSettings.php b/apps/dav/lib/Settings/CalDAVSettings.php
index 0e0525e29a4..fb541e1574f 100644
--- a/apps/dav/lib/Settings/CalDAVSettings.php
+++ b/apps/dav/lib/Settings/CalDAVSettings.php
@@ -29,9 +29,9 @@ use OCA\DAV\AppInfo\Application;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\AppFramework\Services\IInitialState;
-use OCP\Settings\ISettings;
+use OCP\Settings\IDelegatedSettings;
-class CalDAVSettings implements ISettings {
+class CalDAVSettings implements IDelegatedSettings {
/** @var IConfig */
private $config;
@@ -39,6 +39,13 @@ class CalDAVSettings implements ISettings {
/** @var IInitialState */
private $initialState;
+ private const defaults = [
+ 'sendInvitations' => 'yes',
+ 'generateBirthdayCalendar' => 'yes',
+ 'sendEventReminders' => 'yes',
+ 'sendEventRemindersPush' => 'no',
+ ];
+
/**
* CalDAVSettings constructor.
*
@@ -51,13 +58,7 @@ class CalDAVSettings implements ISettings {
}
public function getForm(): TemplateResponse {
- $defaults = [
- 'sendInvitations' => 'yes',
- 'generateBirthdayCalendar' => 'yes',
- 'sendEventReminders' => 'yes',
- 'sendEventRemindersPush' => 'no',
- ];
- foreach ($defaults as $key => $default) {
+ foreach (self::defaults as $key => $default) {
$value = $this->config->getAppValue(Application::APP_ID, $key, $default);
$this->initialState->provideInitialState($key, $value === 'yes');
}
@@ -77,4 +78,14 @@ class CalDAVSettings implements ISettings {
public function getPriority() {
return 10;
}
+
+ public function getName(): ?string {
+ return null; // Only setting in this section
+ }
+
+ public function getAuthorizedAppConfig(): array {
+ return [
+ 'dav' => ['/(' . implode('|', array_keys(self::defaults)) . ')/']
+ ];
+ }
}