Allow empty permissions array
This commit is contained in:
parent
6f9aa130d8
commit
088b6a5503
|
@ -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/
|
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/
|
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/
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(is_array($permissions[$this->action]) && empty($permissions[$this->action])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$permission = null;
|
$permission = null;
|
||||||
|
|
||||||
foreach ($permissions[$this->action] as $permission) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue