PermissionVerificationListener   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 10 2
1
<?php
2
3
namespace App\EventListener\Auth;
4
5
use Prob\Handler\ProcInterface;
6
use App\Auth\AuthManager;
7
use App\Auth\LoginManagerInterface;
8
use App\EventListener\Auth\Exception\PermissionDenied;
9
10
class PermissionVerificationListener
11
{
12
    public function validate(ProcInterface $proc, LoginManagerInterface $loginManager)
13
    {
14
        if (AuthManager::getPermissionManager()
15
                ->hasAllowedRole($loginManager->getLoggedAccountId(), $proc->getName()) === false
16
        ) {
17
            throw new PermissionDenied('This operation is not allowed');
18
        }
19
20
        return true;
21
    }
22
}
23