- Now allowing privilege from enums

This commit is contained in:
Dave M. 2023-11-03 08:27:53 -04:00
parent c5a42a9093
commit 3e684fbd81
2 changed files with 3 additions and 1 deletions

View File

@ -6,7 +6,7 @@
"authors": [ "authors": [
{ {
"name": "Dave Mc Nicoll", "name": "Dave Mc Nicoll",
"email": "dave.mcnicoll@cslsj.qc.ca" "email": "info@mcnd.ca"
} }
], ],
"autoload": { "autoload": {

View File

@ -34,6 +34,8 @@ class Taxus
public function granted($name, ...$arguments) : bool public function granted($name, ...$arguments) : bool
{ {
$name = $name instanceof \BackedEnum ? $name->value : $name;
if ( ! isset($this->list[$name]) ) { if ( ! isset($this->list[$name]) ) {
throw new \InvalidArgumentException("Privilege '{$name}' could not be found. Did you forgot to add it to your Taxus object ?"); throw new \InvalidArgumentException("Privilege '{$name}' could not be found. Did you forgot to add it to your Taxus object ?");
} }