]> source.dussan.org Git - nextcloud-server.git/commitdiff
Unify settings middleware with others 21546/head
authorJoas Schilling <coding@schilljs.com>
Tue, 23 Jun 2020 18:18:38 +0000 (20:18 +0200)
committerJoas Schilling <coding@schilljs.com>
Tue, 23 Jun 2020 18:18:38 +0000 (20:18 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/settings/lib/Controller/AuthSettingsController.php
apps/settings/lib/Controller/ChangePasswordController.php
apps/settings/lib/Controller/HelpController.php
apps/settings/lib/Controller/PersonalSettingsController.php
apps/settings/lib/Controller/UsersController.php
apps/settings/lib/Controller/WebAuthnController.php
apps/settings/lib/Middleware/SubadminMiddleware.php
apps/settings/tests/Middleware/SubadminMiddlewareTest.php

index c7099f284992bfc01c165ce900e8e9657af85be7..13815f95c50f88823dd28a8e74750e807f996c16 100644 (file)
@@ -114,7 +114,7 @@ class AuthSettingsController extends Controller {
 
        /**
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         * @PasswordConfirmationRequired
         *
         * @param string $name
@@ -183,7 +183,7 @@ class AuthSettingsController extends Controller {
 
        /**
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         *
         * @param int $id
         * @return array|JSONResponse
@@ -205,7 +205,7 @@ class AuthSettingsController extends Controller {
 
        /**
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         *
         * @param int $id
         * @param array $scope
@@ -278,7 +278,7 @@ class AuthSettingsController extends Controller {
 
        /**
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         * @PasswordConfirmationRequired
         *
         * @param int $id
index e6567bf9043a6f54cfa575530b4ca3c7d024874f..3006e89318fce5ffe9e16b03002cb816ffc4a0f6 100644 (file)
@@ -85,7 +85,7 @@ class ChangePasswordController extends Controller {
 
        /**
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         * @BruteForceProtection(action=changePersonalPassword)
         */
        public function changePersonalPassword(string $oldpassword = '', string $newpassword = null): JSONResponse {
index 8ebfeb2d4ca4f61dd6ffaaa36e63288159e80595..d5f0aa28e6eff8f0dd7be806440c0bd16de70cb4 100644 (file)
@@ -67,7 +67,7 @@ class HelpController extends Controller {
         *
         * @NoCSRFRequired
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         */
        public function help(string $mode = 'user'): TemplateResponse {
                $this->navigationManager->setActiveEntry('help');
index 0aff8bee649304f91deaa74310ca27ea837580e9..37d19e0904dee3c5e6fe2af7c21f6f50247df95d 100644 (file)
@@ -61,7 +61,7 @@ class PersonalSettingsController extends Controller {
         *
         * @NoCSRFRequired
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         */
        public function index($section) {
                return $this->getIndexResponse('personal', $section);
index d6410810d804d1b70a0b78452253ff1e940c23b3..eab6c087d86261bc1ba3cb8d2cf77b0e768adb5e 100644 (file)
@@ -311,7 +311,7 @@ class UsersController extends Controller {
 
        /**
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         * @PasswordConfirmationRequired
         *
         * @param string $avatarScope
@@ -440,7 +440,7 @@ class UsersController extends Controller {
         * Set the mail address of a user
         *
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         * @PasswordConfirmationRequired
         *
         * @param string $account
index db6fc303a056cf4fcd79710472b43dad307bcc8a..d6a61322be9274591031fc4cc820cd87438d7f23 100644 (file)
@@ -65,7 +65,7 @@ class WebAuthnController extends Controller {
 
        /**
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         * @PasswordConfirmationRequired
         * @UseSession
         * @NoCSRFRequired
@@ -83,7 +83,7 @@ class WebAuthnController extends Controller {
 
        /**
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         * @PasswordConfirmationRequired
         * @UseSession
         */
@@ -105,7 +105,7 @@ class WebAuthnController extends Controller {
 
        /**
         * @NoAdminRequired
-        * @NoSubadminRequired
+        * @NoSubAdminRequired
         * @PasswordConfirmationRequired
         */
        public function deleteRegistration(int $id): JSONResponse {
index 7fa30c8e26c079f63f48ed1d4423d930cc0dafa1..41020ab0a85b75c13034c55299d8978bc52552d8 100644 (file)
@@ -35,7 +35,7 @@ use OCP\IL10N;
 
 /**
  * Verifies whether an user has at least subadmin rights.
- * To bypass use the `@NoSubadminRequired` annotation
+ * To bypass use the `@NoSubAdminRequired` annotation
  */
 class SubadminMiddleware extends Middleware {
        /** @var bool */
@@ -65,7 +65,7 @@ class SubadminMiddleware extends Middleware {
         * @throws \Exception
         */
        public function beforeController($controller, $methodName) {
-               if (!$this->reflector->hasAnnotation('NoSubadminRequired')) {
+               if (!$this->reflector->hasAnnotation('NoSubAdminRequired')) {
                        if (!$this->isSubAdmin) {
                                throw new NotAdminException($this->l10n->t('Logged in user must be a subadmin'));
                        }
index ad68d3b615ea530e7e6984e1af9af5148c63bf6f..12d5cee714af4545f68117bcc5bf042ad51f2303 100644 (file)
@@ -36,7 +36,7 @@ use OCP\IL10N;
 
 /**
  * Verifies whether an user has at least subadmin rights.
- * To bypass use the `@NoSubadminRequired` annotation
+ * To bypass use the `@NoSubAdminRequired` annotation
  *
  * @package Tests\Settings\Middleware
  */
@@ -64,14 +64,14 @@ class SubadminMiddlewareTest extends \Test\TestCase {
                $this->subadminMiddleware = new SubadminMiddleware($this->reflector, false, $this->l10n);
        }
 
-       
+
        public function testBeforeControllerAsUserWithExemption() {
                $this->expectException(\OC\AppFramework\Middleware\Security\Exceptions\NotAdminException::class);
 
                $this->reflector
                        ->expects($this->once())
                        ->method('hasAnnotation')
-                       ->with('NoSubadminRequired')
+                       ->with('NoSubAdminRequired')
                        ->willReturn(false);
                $this->subadminMiddleware->beforeController($this->controller, 'foo');
        }
@@ -81,7 +81,7 @@ class SubadminMiddlewareTest extends \Test\TestCase {
                $this->reflector
                        ->expects($this->once())
                        ->method('hasAnnotation')
-                       ->with('NoSubadminRequired')
+                       ->with('NoSubAdminRequired')
                        ->willReturn(true);
                $this->subadminMiddleware->beforeController($this->controller, 'foo');
        }
@@ -90,7 +90,7 @@ class SubadminMiddlewareTest extends \Test\TestCase {
                $this->reflector
                        ->expects($this->once())
                        ->method('hasAnnotation')
-                       ->with('NoSubadminRequired')
+                       ->with('NoSubAdminRequired')
                        ->willReturn(false);
                $this->subadminMiddlewareAsSubAdmin->beforeController($this->controller, 'foo');
        }
@@ -99,7 +99,7 @@ class SubadminMiddlewareTest extends \Test\TestCase {
                $this->reflector
                        ->expects($this->once())
                        ->method('hasAnnotation')
-                       ->with('NoSubadminRequired')
+                       ->with('NoSubAdminRequired')
                        ->willReturn(true);
                $this->subadminMiddlewareAsSubAdmin->beforeController($this->controller, 'foo');
        }
@@ -110,7 +110,7 @@ class SubadminMiddlewareTest extends \Test\TestCase {
                $this->assertEquals($expectedResponse, $this->subadminMiddleware->afterException($this->controller, 'foo', new NotAdminException('')));
        }
 
-       
+
        public function testAfterRegularException() {
                $this->expectException(\Exception::class);