@@ 101-116 (lines=16) @@ | ||
98 | * @return boolean|null Returns TRUE if and only if all the $privileges are granted against all $roles. |
|
99 | * Returns NULL if no applicable roles, resource, or permissions could be checked. |
|
100 | */ |
|
101 | public function allRolesGrantedAll($roles, $resource, $privileges) |
|
102 | { |
|
103 | $roles = (array)$roles; |
|
104 | $privileges = (array)$privileges; |
|
105 | $result = null; |
|
106 | ||
107 | foreach ($roles as $role) { |
|
108 | if (!$this->isRoleGrantedAll($role, $resource, $privileges)) { |
|
109 | return false; |
|
110 | } |
|
111 | ||
112 | $result = true; |
|
113 | } |
|
114 | ||
115 | return $result; |
|
116 | } |
|
117 | ||
118 | /** |
|
119 | * Check if access is granted to any one of the roles for all permissions. |
|
@@ 184-199 (lines=16) @@ | ||
181 | * @return boolean|null Returns TRUE if any one of the $privileges are granted against all $roles. |
|
182 | * Returns NULL if no applicable roles, resource, or permissions could be checked. |
|
183 | */ |
|
184 | public function allRolesGrantedAny($roles, $resource, $privileges) |
|
185 | { |
|
186 | $roles = (array)$roles; |
|
187 | $privileges = (array)$privileges; |
|
188 | $result = null; |
|
189 | ||
190 | foreach ($roles as $role) { |
|
191 | if (!$this->isRoleGrantedAny($role, $resource, $privileges)) { |
|
192 | return false; |
|
193 | } |
|
194 | ||
195 | $result = true; |
|
196 | } |
|
197 | ||
198 | return $result; |
|
199 | } |
|
200 | ||
201 | /** |
|
202 | * Check if access is granted to any one of the roles for any one of the permissions. |