public function deleteUser($userId)
    {
        $user = $this->userService->loadUser($userId);

        if ($user->id == $this->repository->getCurrentUser()->id) {
            throw new Exceptions\ForbiddenException('Currently authenticated user cannot be deleted');
        }

        $this->userService->deleteUser($user);

        return new Values\NoContent();
    }
public function deleteUser($userId)
    {
        $user = $this->userService->loadUser($userId);

        if ($user->id == $this->repository->getCurrentUser()->id) {
            throw new Exceptions\ForbiddenException('Currently authenticated user cannot be deleted');
        }

        $this->userService->deleteUser($user);

        return new Values\NoContent();
    }
public function deleteUser ( $ userId ) { $ user = $ this -> userService -> loadUser ( $ userId ) ; if ( $ user -> id == $ this -> repository -> getCurrentUser ( ) -> id ) { throw new Exceptions \ ForbiddenException ( 'Currently authenticated user cannot be deleted' ) ; } $ this -> userService -> deleteUser ( $ user ) ; return new Values \ NoContent ( ) ; }
Given user is deleted.

@param $userId

@throws \eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException

@return \eZ\Publish\Core\REST\Server\Values\NoContent
Given user is deleted .