summaryrefslogtreecommitdiff
path: root/app/Middleware/ApplicationAuthorizationMiddleware.php
blob: faca2d6a4d735d45fd8f14943857866e8d679655 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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();
    }
}