summaryrefslogtreecommitdiffstats
path: root/lib/Settings
diff options
context:
space:
mode:
authormatthias <matthias@butler>2020-03-30 23:32:37 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2020-07-25 09:40:05 +0200
commite84571f0037b1222549e5fe9b4ac65ee4a1285aa (patch)
tree691f701b6021e6b0db7fcf339afe0edb69e5a617 /lib/Settings
parente2633171d6a0581c76fcbf9abb162b581b1d219e (diff)
Allow for avatar downloads from social networks
Signed-off-by: call-me-matt <nextcloud@matthiasheinisch.de>
Diffstat (limited to 'lib/Settings')
-rw-r--r--lib/Settings/AdminSettings.php78
1 files changed, 78 insertions, 0 deletions
diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php
new file mode 100644
index 00000000..c8460917
--- /dev/null
+++ b/lib/Settings/AdminSettings.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ * @copyright Copyright (c) 2020 Matthias Heinisch <nextcloud@matthiasheinisch.de>
+ *
+ * @author Matthias Heinisch <nextcloud@matthiasheinisch.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Contacts\Settings;
+
+use OCA\Contacts\AppInfo\Application;
+use OCP\AppFramework\Http\TemplateResponse;
+use OCP\IConfig;
+use OCP\IInitialStateService;
+use OCP\Settings\ISettings;
+
+class AdminSettings implements ISettings {
+
+ /** @var IConfig */
+ private $config;
+
+ /** @var IInitialStateService */
+ private $initialStateService;
+
+ /**
+ * Admin constructor.
+ *
+ * @param IConfig $config
+ * @param IL10N $l
+ */
+ public function __construct(IConfig $config, IInitialStateService $initialStateService) {
+ $this->appName = Application::APP_ID;
+ $this->config = $config;
+ $this->initialStateService = $initialStateService;
+ }
+
+ /**
+ * @return TemplateResponse
+ */
+ public function getForm() {
+ foreach (Application::AVAIL_SETTINGS as $key => $default) {
+ $data = $this->config->getAppValue($this->appName, $key, $default);
+ $this->initialStateService->provideInitialState($this->appName, $key, $data);
+ }
+ return new TemplateResponse($this->appName, 'settings/admin');
+ }
+
+ /**
+ * @return string the section ID, e.g. 'sharing'
+ */
+ public function getSection() {
+ return 'groupware';
+ }
+
+ /**
+ * @return int whether the form should be rather on the top or bottom of
+ * the admin section. The forms are arranged in ascending order of the
+ * priority values. It is required to return a value between 0 and 100.
+ */
+ public function getPriority() {
+ return 75;
+ }
+}