public function removePolicyByRoleDraft(APIRoleDraft $roleDraft, PolicyDraft $policyDraft)
    {
        if ($this->repository->hasAccess('role', 'update') !== true) {
            throw new UnauthorizedException('role', 'update');
        }

        if ($policyDraft->roleId != $roleDraft->id) {
            throw new InvalidArgumentException('$policy', 'Policy does not belong to the given role');
        }

        $this->internalDeletePolicy($policyDraft);

        return $this->loadRoleDraft($roleDraft->id);
    }
public function removePolicyByRoleDraft(APIRoleDraft $roleDraft, PolicyDraft $policyDraft)
    {
        if ($this->repository->hasAccess('role', 'update') !== true) {
            throw new UnauthorizedException('role', 'update');
        }

        if ($policyDraft->roleId != $roleDraft->id) {
            throw new InvalidArgumentException('$policy', 'Policy does not belong to the given role');
        }

        $this->internalDeletePolicy($policyDraft);

        return $this->loadRoleDraft($roleDraft->id);
    }
public function removePolicyByRoleDraft ( APIRoleDraft $ roleDraft , PolicyDraft $ policyDraft ) { if ( $ this -> repository -> hasAccess ( 'role' , 'update' ) !== true ) { throw new UnauthorizedException ( 'role' , 'update' ) ; } if ( $ policyDraft -> roleId != $ roleDraft -> id ) { throw new InvalidArgumentException ( '$policy' , 'Policy does not belong to the given role' ) ; } $ this -> internalDeletePolicy ( $ policyDraft ) ; return $ this -> loadRoleDraft ( $ roleDraft -> id ) ; }
Removes a policy from a RoleDraft.

@since 6.0

@throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a policy
@throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException if policy does not belong to the given RoleDraft

@param \eZ\Publish\API\Repository\Values\User\RoleDraft $roleDraft
@param PolicyDraft $policyDraft the policy to remove from the RoleDraft

@return APIRoleDraft if the authenticated user is not allowed to remove a policy
Removes a policy from a RoleDraft .