eZ\Publish\Core\REST\Server\Controller\User::deleteUserGroup PHP Method

deleteUserGroup() public method

Given user group is deleted.
public deleteUserGroup ( $groupPath ) : eZ\Publish\Core\REST\Server\Values\NoContent
$groupPath
return eZ\Publish\Core\REST\Server\Values\NoContent
    public function deleteUserGroup($groupPath)
    {
        $userGroupLocation = $this->locationService->loadLocation($this->extractLocationIdFromPath($groupPath));
        $userGroup = $this->userService->loadUserGroup($userGroupLocation->contentId);
        // Load one user to see if user group is empty or not
        $users = $this->userService->loadUsersOfUserGroup($userGroup, 0, 1);
        if (!empty($users)) {
            throw new Exceptions\ForbiddenException('Non-empty user groups cannot be deleted');
        }
        $this->userService->deleteUserGroup($userGroup);
        return new Values\NoContent();
    }