diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-26 15:32:17 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-02-26 17:00:29 +0100 |
commit | cf35c4b03ab7bd73cc5e9a26d88a0c61731d4b6e (patch) | |
tree | 86862b1127934c6c6261b9cd248eaafcf355bf4c /settings/Middleware | |
parent | 98baf8915dcaba69266820066cb49abbcc43e624 (diff) | |
download | nextcloud-server-cf35c4b03ab7bd73cc5e9a26d88a0c61731d4b6e.tar.gz nextcloud-server-cf35c4b03ab7bd73cc5e9a26d88a0c61731d4b6e.zip |
Provide translated error message for permission error
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'settings/Middleware')
-rw-r--r-- | settings/Middleware/SubadminMiddleware.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/settings/Middleware/SubadminMiddleware.php b/settings/Middleware/SubadminMiddleware.php index 9914d65af02..5df17cb13b4 100644 --- a/settings/Middleware/SubadminMiddleware.php +++ b/settings/Middleware/SubadminMiddleware.php @@ -30,6 +30,7 @@ use OC\AppFramework\Utility\ControllerMethodReflector; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Middleware; +use OCP\IL10N; /** * Verifies whether an user has at least subadmin rights. @@ -42,15 +43,20 @@ class SubadminMiddleware extends Middleware { protected $isSubAdmin; /** @var ControllerMethodReflector */ protected $reflector; + /** @var IL10N */ + private $l10n; /** * @param ControllerMethodReflector $reflector * @param bool $isSubAdmin + * @param IL10N $l10n */ public function __construct(ControllerMethodReflector $reflector, - $isSubAdmin) { + $isSubAdmin, + IL10N $l10n) { $this->reflector = $reflector; $this->isSubAdmin = $isSubAdmin; + $this->l10n = $l10n; } /** @@ -62,7 +68,7 @@ class SubadminMiddleware extends Middleware { public function beforeController($controller, $methodName) { if(!$this->reflector->hasAnnotation('NoSubadminRequired')) { if(!$this->isSubAdmin) { - throw new NotAdminException('Logged in user must be a subadmin'); + throw new NotAdminException($this->l10n->t('Logged in user must be a subadmin')); } } } |