protected function authorize(string $permission, array $context = []): bool
    {
        if (!$this->allows($permission, $context)) {
            $name = $this->resolvePermission($permission);

            throw new ControllerException(
                "Unauthorized permission '{$name}'",
                ControllerException::FORBIDDEN
            );
        }

        return true;
    }
protected function authorize(string $permission, array $context = []): bool
    {
        if (!$this->allows($permission, $context)) {
            $name = $this->resolvePermission($permission);

            throw new ControllerException(
                "Unauthorized permission '{$name}'",
                ControllerException::FORBIDDEN
            );
        }

        return true;
    }
protected function authorize ( string $ permission , array $ context = [ ] ) : bool { if ( ! $ this -> allows ( $ permission , $ context ) ) { $ name = $ this -> resolvePermission ( $ permission ) ; throw new ControllerException ( "Unauthorized permission '{$name}'" , ControllerException :: FORBIDDEN ) ; } return true ; }
Authorize permission or thrown controller exception.

@param string $permission
@param array  $context
@return bool

@throws ControllerException
Authorize permission or thrown controller exception .