/**
* 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 */
* @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'));
}
/**
* 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
*/
$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');
}
$this->reflector
->expects($this->once())
->method('hasAnnotation')
- ->with('NoSubadminRequired')
+ ->with('NoSubAdminRequired')
->willReturn(true);
$this->subadminMiddleware->beforeController($this->controller, 'foo');
}
$this->reflector
->expects($this->once())
->method('hasAnnotation')
- ->with('NoSubadminRequired')
+ ->with('NoSubAdminRequired')
->willReturn(false);
$this->subadminMiddlewareAsSubAdmin->beforeController($this->controller, 'foo');
}
$this->reflector
->expects($this->once())
->method('hasAnnotation')
- ->with('NoSubadminRequired')
+ ->with('NoSubAdminRequired')
->willReturn(true);
$this->subadminMiddlewareAsSubAdmin->beforeController($this->controller, 'foo');
}
$this->assertEquals($expectedResponse, $this->subadminMiddleware->afterException($this->controller, 'foo', new NotAdminException('')));
}
-
+
public function testAfterRegularException() {
$this->expectException(\Exception::class);