@@ 70-90 (lines=21) @@ | ||
67 | * @return boolean|null Returns TRUE if and only if all the $privileges are granted against the $role. |
|
68 | * Returns NULL if no applicable role, resource, or permissions could be checked. |
|
69 | */ |
|
70 | public function isRoleGrantedAll($role, $resource, $privileges) |
|
71 | { |
|
72 | $privileges = (array)$privileges; |
|
73 | $result = null; |
|
74 | ||
75 | try { |
|
76 | foreach ($privileges as $privilege) { |
|
77 | if (!$this->isAllowed($role, $resource, $privilege)) { |
|
78 | return false; |
|
79 | } |
|
80 | ||
81 | $result = true; |
|
82 | } |
|
83 | ||
84 | return $result; |
|
85 | } catch (AclExceptionInterface $e) { |
|
86 | $this->logger->error('[ACL] '.$e->getMessage()); |
|
87 | } |
|
88 | ||
89 | return null; |
|
90 | } |
|
91 | ||
92 | /** |
|
93 | * Check if access is granted to all roles for all permissions. |
|
@@ 153-173 (lines=21) @@ | ||
150 | * @return boolean|null Returns TRUE if any one of the $privileges are granted against the $role. |
|
151 | * Returns NULL if no applicable role, resource, or permissions could be checked. |
|
152 | */ |
|
153 | public function isRoleGrantedAny($role, $resource, $privileges) |
|
154 | { |
|
155 | $privileges = (array)$privileges; |
|
156 | $result = null; |
|
157 | ||
158 | try { |
|
159 | foreach ($privileges as $privilege) { |
|
160 | if ($this->isAllowed($role, $resource, $privilege)) { |
|
161 | return true; |
|
162 | } |
|
163 | ||
164 | $result = false; |
|
165 | } |
|
166 | ||
167 | return $result; |
|
168 | } catch (AclExceptionInterface $e) { |
|
169 | $this->logger->error('[ACL] '.$e->getMessage()); |
|
170 | } |
|
171 | ||
172 | return null; |
|
173 | } |
|
174 | ||
175 | /** |
|
176 | * Check if access is granted to all roles for any one of the permissions. |