summaryrefslogtreecommitdiff
path: root/app/Api/Authorization/UserAuthorization.php
blob: 3fd6865cc9669e2596dfb08867e8417be214ca40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

namespace Kanboard\Api\Authorization;

use JsonRPC\Exception\AccessDeniedException;
use Kanboard\Core\Base;

/**
 * Class UserAuthorization
 *
 * @package Kanboard\Api\Authorization
 * @author  Frederic Guillot
 */
class UserAuthorization extends Base
{
    public function check($class, $method)
    {
        if ($this->userSession->isLogged() && ! $this->apiAuthorization->isAllowed($class, $method, $this->userSession->getRole())) {
            throw new AccessDeniedException('You are not allowed to access to this resource');
        }
    }
}