public function revokeUserAccess($resource, string $action)
    {
        $resourceRule = $this->getUserPermission($resource);

        if (!$resourceRule) {
            return;
        }

        // make sure we can work with this
        if ($resourceRule && !($resourceRule instanceof UserPermissionInterface)) {
            throw new PermissionExpectedException(UserPermissionInterface::class, \get_class($resourceRule));
        }

        if ($resourceRule) {
            if (!\in_array($action, $resourceRule->getActions(), true)) {
                return;
            }
            $resourceRule->removeAction($action);
            $this->userPermissions->update($resourceRule);
        }
    }
public function revokeUserAccess($resource, string $action)
    {
        $resourceRule = $this->getUserPermission($resource);

        if (!$resourceRule) {
            return;
        }

        // make sure we can work with this
        if ($resourceRule && !($resourceRule instanceof UserPermissionInterface)) {
            throw new PermissionExpectedException(UserPermissionInterface::class, \get_class($resourceRule));
        }

        if ($resourceRule) {
            if (!\in_array($action, $resourceRule->getActions(), true)) {
                return;
            }
            $resourceRule->removeAction($action);
            $this->userPermissions->update($resourceRule);
        }
    }
public function revokeUserAccess ( $ resource , string $ action ) { $ resourceRule = $ this -> getUserPermission ( $ resource ) ; if ( ! $ resourceRule ) { return ; } // make sure we can work with this if ( $ resourceRule && ! ( $ resourceRule instanceof UserPermissionInterface ) ) { throw new PermissionExpectedException ( UserPermissionInterface :: class , \ get_class ( $ resourceRule ) ) ; } if ( $ resourceRule ) { if ( ! \ in_array ( $ action , $ resourceRule -> getActions ( ) , true ) ) { return ; } $ resourceRule -> removeAction ( $ action ) ; $ this -> userPermissions -> update ( $ resourceRule ) ; } }
Revoke access to a resource

@param ResourceInterface|string $resource
@param string                   $action

@throws PermissionExpectedException
@throws UnknownResourceTypeException
@throws UserRequiredException
Revoke access to a resource