- Now allowing privilege from enums
This commit is contained in:
parent
c5a42a9093
commit
3e684fbd81
|
@ -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": {
|
||||||
|
|
|
@ -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 ?");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue