|
10 | 10 | */ |
11 | 11 | class UserRoleAuthorizator extends AbstractAuthorizator { |
12 | 12 |
|
| 13 | + protected $roles; |
| 14 | + protected $grantResults; |
| 15 | + protected $subroles; |
| 16 | + |
13 | 17 | public function __construct(Application $app, $config = NULL) { |
14 | 18 | parent::__construct($app, $config); |
15 | 19 | if (isset($this->config['roles'])) { |
@@ -38,23 +42,23 @@ public function authorize($user, $required) { |
38 | 42 |
|
39 | 43 | // From here on we need a user object |
40 | 44 | if ($user != NULL) { |
41 | | - if (!isset($this->grantResult[$required.'-'.$user->uid])) { |
| 45 | + if (!isset($this->grantResults[$required.'-'.$user->uid])) { |
42 | 46 | // Least privilege: any user |
43 | 47 | if ($required == UserRole::ROLE_USER) { |
44 | | - $this->grantResult[$required.'-'.$user->uid] = TRUE; |
| 48 | + $this->grantResults[$required.'-'.$user->uid] = TRUE; |
45 | 49 | } else { |
46 | 50 | $roles = $user->getRoles(); |
47 | 51 |
|
48 | 52 | // Superadmins are always authorized |
49 | 53 | if (in_array(UserRole::ROLE_SUPERADMIN, $roles)) { |
50 | | - $this->grantResult[$required.'-'.$user->uid] = TRUE; |
| 54 | + $this->grantResults[$required.'-'.$user->uid] = TRUE; |
51 | 55 | } else { |
52 | 56 | // Search the specific role |
53 | | - $this->grantResult[$required.'-'.$user->uid] = $this->isGranted($required, $roles); |
| 57 | + $this->grantResults[$required.'-'.$user->uid] = $this->isGranted($required, $roles); |
54 | 58 | } |
55 | 59 | } |
56 | 60 | } |
57 | | - return $this->grantResult[$required.'-'.$user->uid]; |
| 61 | + return $this->grantResults[$required.'-'.$user->uid]; |
58 | 62 | } |
59 | 63 | return FALSE; |
60 | 64 | } |
|
0 commit comments