From 088b6a55033de33bfc17996c25879b2bc53ed9bb Mon Sep 17 00:00:00 2001 From: eldadfux Date: Sun, 20 Oct 2019 21:28:07 +0300 Subject: [PATCH] Allow empty permissions array --- app/sdks/dart/.packages | 2 +- src/Database/Validator/Authorization.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/sdks/dart/.packages b/app/sdks/dart/.packages index 8bb87976f..a4f764b10 100644 --- a/app/sdks/dart/.packages +++ b/app/sdks/dart/.packages @@ -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/ diff --git a/src/Database/Validator/Authorization.php b/src/Database/Validator/Authorization.php index 1d08d3e38..6af0420d9 100644 --- a/src/Database/Validator/Authorization.php +++ b/src/Database/Validator/Authorization.php @@ -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; }