taxus/src/UserEntityTrait.php

22 lines
503 B
PHP
Raw Normal View History

2021-08-27 18:08:35 +00:00
<?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);
}
}