Allow empty permissions array
This commit is contained in:
parent
6f9aa130d8
commit
088b6a5503
2 changed files with 6 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
# Generated by pub on 2019-10-20 07:15:41.003960.
|
||||
# Generated by pub on 2019-10-20 15:13:23.423618.
|
||||
charcode:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib/
|
||||
collection:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/collection-1.14.12/lib/
|
||||
cookie_jar:file:///Users/eldadfux/.pub-cache/hosted/pub.dartlang.org/cookie_jar-1.0.1/lib/
|
||||
|
|
|
@ -72,6 +72,10 @@ class Authorization extends Validator
|
|||
return false;
|
||||
}
|
||||
|
||||
if(is_array($permissions[$this->action]) && empty($permissions[$this->action])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$permission = null;
|
||||
|
||||
foreach ($permissions[$this->action] as $permission) {
|
||||
|
@ -82,7 +86,7 @@ class Authorization extends Validator
|
|||
}
|
||||
}
|
||||
|
||||
$this->message = 'User is missing '.$this->action.' for '.$permission.' permission. only this scope "'.json_encode(self::getRoles()).'" is given.';
|
||||
$this->message = 'User is missing '.$this->action.' for "'.$permission.'" permission. Only this scopes "'.json_encode(self::getRoles()).'" is given and only this are allowed "'.json_encode($permissions[$this->action]).'".';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue