Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_antivirus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2021-10-14 12:06:20 +0300
committerCarl Schwan <carl@carlschwan.eu>2021-10-14 12:06:51 +0300
commit8273aa8de23e29be99a3292c004cb06e6af4b184 (patch)
tree661602753e1597ff7ff61bd9668028c6fcade52f /lib
parent983503aeb072bdfcabfc6d6ec6bb20cda9117fbc (diff)
Add admin delegation support
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/SettingsController.php1
-rw-r--r--lib/Settings/Admin.php22
2 files changed, 20 insertions, 3 deletions
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php
index f252cc3..550b4a1 100644
--- a/lib/Controller/SettingsController.php
+++ b/lib/Controller/SettingsController.php
@@ -42,6 +42,7 @@ class SettingsController extends Controller {
/**
* Save Parameters
*
+ * @AuthorizedAdminSetting(settings=OCA\Files_Antivirus\Settings\Admin)
* @param string $avMode - antivirus mode
* @param string $avSocket - path to socket (Socket mode)
* @param string $avHost - antivirus url
diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php
index 6b51c4f..084e6e1 100644
--- a/lib/Settings/Admin.php
+++ b/lib/Settings/Admin.php
@@ -3,6 +3,7 @@
* @copyright Copyright (c) 2018 Roeland Jago Douma <roeland@famdouma.nl>
*
* @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author Carl Schwan <carl@carlschwan.eu>
*
* @license GNU AGPL version 3 or any later version
*
@@ -24,15 +25,20 @@ namespace OCA\Files_Antivirus\Settings;
use OCA\Files_Antivirus\AppConfig;
use OCP\AppFramework\Http\TemplateResponse;
-use OCP\Settings\ISettings;
+use OCP\IL10N;
+use OCP\Settings\IDelegatedSettings;
-class Admin implements ISettings {
+class Admin implements IDelegatedSettings {
/** @var AppConfig */
private $config;
- public function __construct(AppConfig $config) {
+ /** @var IL10n */
+ private $l;
+
+ public function __construct(AppConfig $config, IL10n $l) {
$this->config = $config;
+ $this->l = $l;
}
public function getForm() {
@@ -47,4 +53,14 @@ class Admin implements ISettings {
public function getPriority() {
return 90;
}
+
+ public function getName(): string {
+ return $this->l->t("Antivirus");
+ }
+
+ public function getAuthorizedAppConfig(): array {
+ return [
+ 'files_antivirus' => ['.*'],
+ ];
+ }
}