protected function hasPermission(string $permission, bool $return = false)
    {
        $auth = $this->getContext()->getAuthentication();
        $user = $auth->getUser();
        $acl = $this->getContext()->getAccessControlList();

        if (!$acl->hasAccess($user, $permission)) {

            if ($return) {
                return false;
            }else{
                throw HttpException::forbidden('The current user has no permission to this action');
            }
        }

        return true;
    }