summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-06-23 20:18:38 +0200
committerJoas Schilling <coding@schilljs.com>2020-06-23 20:18:38 +0200
commit6e46df26a8bc47c08ba622df07540d73cb8c7c1f (patch)
treeb6f84792432e6d61d9c2b0ba643c2531c3a66bb3 /apps
parentad0731a63c52ea07bff23eb72fc0479e2be76142 (diff)
downloadnextcloud-server-6e46df26a8bc47c08ba622df07540d73cb8c7c1f.tar.gz
nextcloud-server-6e46df26a8bc47c08ba622df07540d73cb8c7c1f.zip
Unify settings middleware with others
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/settings/lib/Controller/AuthSettingsController.php8
-rw-r--r--apps/settings/lib/Controller/ChangePasswordController.php2
-rw-r--r--apps/settings/lib/Controller/HelpController.php2
-rw-r--r--apps/settings/lib/Controller/PersonalSettingsController.php2
-rw-r--r--apps/settings/lib/Controller/UsersController.php4
-rw-r--r--apps/settings/lib/Controller/WebAuthnController.php6
-rw-r--r--apps/settings/lib/Middleware/SubadminMiddleware.php4
-rw-r--r--apps/settings/tests/Middleware/SubadminMiddlewareTest.php14
8 files changed, 21 insertions, 21 deletions
diff --git a/apps/settings/lib/Controller/AuthSettingsController.php b/apps/settings/lib/Controller/AuthSettingsController.php
index c7099f28499..13815f95c50 100644
--- a/apps/settings/lib/Controller/AuthSettingsController.php
+++ b/apps/settings/lib/Controller/AuthSettingsController.php
@@ -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
diff --git a/apps/settings/lib/Controller/ChangePasswordController.php b/apps/settings/lib/Controller/ChangePasswordController.php
index e6567bf9043..3006e89318f 100644
--- a/apps/settings/lib/Controller/ChangePasswordController.php
+++ b/apps/settings/lib/Controller/ChangePasswordController.php
@@ -85,7 +85,7 @@ class ChangePasswordController extends Controller {
/**
* @NoAdminRequired
- * @NoSubadminRequired
+ * @NoSubAdminRequired
* @BruteForceProtection(action=changePersonalPassword)
*/
public function changePersonalPassword(string $oldpassword = '', string $newpassword = null): JSONResponse {
diff --git a/apps/settings/lib/Controller/HelpController.php b/apps/settings/lib/Controller/HelpController.php
index 8ebfeb2d4ca..d5f0aa28e6e 100644
--- a/apps/settings/lib/Controller/HelpController.php
+++ b/apps/settings/lib/Controller/HelpController.php
@@ -67,7 +67,7 @@ class HelpController extends Controller {
*
* @NoCSRFRequired
* @NoAdminRequired
- * @NoSubadminRequired
+ * @NoSubAdminRequired
*/
public function help(string $mode = 'user'): TemplateResponse {
$this->navigationManager->setActiveEntry('help');
diff --git a/apps/settings/lib/Controller/PersonalSettingsController.php b/apps/settings/lib/Controller/PersonalSettingsController.php
index 0aff8bee649..37d19e0904d 100644
--- a/apps/settings/lib/Controller/PersonalSettingsController.php
+++ b/apps/settings/lib/Controller/PersonalSettingsController.php
@@ -61,7 +61,7 @@ class PersonalSettingsController extends Controller {
*
* @NoCSRFRequired
* @NoAdminRequired
- * @NoSubadminRequired
+ * @NoSubAdminRequired
*/
public function index($section) {
return $this->getIndexResponse('personal', $section);
diff --git a/apps/settings/lib/Controller/UsersController.php b/apps/settings/lib/Controller/UsersController.php
index d6410810d80..eab6c087d86 100644
--- a/apps/settings/lib/Controller/UsersController.php
+++ b/apps/settings/lib/Controller/UsersController.php
@@ -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
diff --git a/apps/settings/lib/Controller/WebAuthnController.php b/apps/settings/lib/Controller/WebAuthnController.php
index db6fc303a05..d6a61322be9 100644
--- a/apps/settings/lib/Controller/WebAuthnController.php
+++ b/apps/settings/lib/Controller/WebAuthnController.php
@@ -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 {
diff --git a/apps/settings/lib/Middleware/SubadminMiddleware.php b/apps/settings/lib/Middleware/SubadminMiddleware.php
index 7fa30c8e26c..41020ab0a85 100644
--- a/apps/settings/lib/Middleware/SubadminMiddleware.php
+++ b/apps/settings/lib/Middleware/SubadminMiddleware.php
@@ -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'));
}
diff --git a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php
index ad68d3b615e..12d5cee714a 100644
--- a/apps/settings/tests/Middleware/SubadminMiddlewareTest.php
+++ b/apps/settings/tests/Middleware/SubadminMiddlewareTest.php
@@ -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);