22 lines
503 B
PHP
22 lines
503 B
PHP
|
<?php
|
||
|
|
||
|
namespace Taxus;
|
||
|
|
||
|
trait UserEntityTrait
|
||
|
{
|
||
|
public ? Taxus $taxus;
|
||
|
|
||
|
public function can(string $privilegeName, ...$arguments) : bool
|
||
|
{
|
||
|
if (! $this->taxus) {
|
||
|
throw new \Exception("An instance of Taxus must be linked to this object.");
|
||
|
}
|
||
|
|
||
|
return $this->taxus->granted($privilegeName, ...$arguments);
|
||
|
}
|
||
|
|
||
|
public function cannot(string $privilegeName, ...$arguments) : bool
|
||
|
{
|
||
|
return ! $this->can($privilegeName, ...$arguments);
|
||
|
}
|
||
|
}
|