Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge branch 'feature/37'
Browse files Browse the repository at this point in the history
Close #37
  • Loading branch information
Xerkus committed Jun 25, 2019
2 parents e5efced + 3898ec8 commit 78fbd21
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ public function setRule(
// ensure that all specified Roles exist; normalize input to array of Role objects or null
if (! is_array($roles)) {
$roles = [$roles];
} elseif (0 === count($roles)) {
} elseif (! $roles) {
$roles = [null];
}
$rolesTemp = $roles;
Expand All @@ -562,7 +562,7 @@ public function setRule(

// ensure that all specified Resources exist; normalize input to array of Resource objects or null
if (! is_array($resources)) {
if (null === $resources && count($this->resources) > 0) {
if (null === $resources && $this->resources) {
$resources = array_keys($this->resources);
// Passing a null resource; make sure "global" permission is also set!
if (! in_array(null, $resources)) {
Expand All @@ -571,7 +571,7 @@ public function setRule(
} else {
$resources = [$resources];
}
} elseif (0 === count($resources)) {
} elseif (! $resources) {
$resources = [null];
}
$resourcesTemp = $resources;
Expand Down Expand Up @@ -602,7 +602,7 @@ public function setRule(
foreach ($resources as $resource) {
foreach ($roles as $role) {
$rules =& $this->getRules($resource, $role, true);
if (0 === count($privileges)) {
if (! $privileges) {
$rules['allPrivileges']['type'] = $type;
$rules['allPrivileges']['assert'] = $assert;
if (! isset($rules['byPrivilegeId'])) {
Expand All @@ -626,7 +626,7 @@ public function setRule(
if (null === $rules) {
continue;
}
if (0 === count($privileges)) {
if (! $privileges) {
if (null === $resource && null === $role) {
if ($type === $rules['allPrivileges']['type']) {
$rules = [
Expand Down

0 comments on commit 78fbd21

Please sign in to comment.