diff options
Diffstat (limited to 'app/Middleware/ApplicationAuthorizationMiddleware.php')
-rw-r--r-- | app/Middleware/ApplicationAuthorizationMiddleware.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/Middleware/ApplicationAuthorizationMiddleware.php b/app/Middleware/ApplicationAuthorizationMiddleware.php new file mode 100644 index 00000000..faca2d6a --- /dev/null +++ b/app/Middleware/ApplicationAuthorizationMiddleware.php @@ -0,0 +1,27 @@ +<?php + +namespace Kanboard\Middleware; + +use Kanboard\Core\Controller\AccessForbiddenException; +use Kanboard\Core\Controller\BaseMiddleware; + +/** + * Class ApplicationAuthorizationMiddleware + * + * @package Kanboard\Middleware + * @author Frederic Guillot + */ +class ApplicationAuthorizationMiddleware extends BaseMiddleware +{ + /** + * Execute middleware + */ + public function execute() + { + if (! $this->helper->user->hasAccess($this->router->getController(), $this->router->getAction())) { + throw new AccessForbiddenException(); + } + + $this->next(); + } +} |