/** * Un-assigns role from user group * * @param $groupPath * @param $roleId * * @return \eZ\Publish\Core\REST\Server\Values\RoleAssignmentList */ public function unassignRoleFromUserGroup($groupPath, $roleId) { $groupLocationParts = explode('/', $groupPath); $groupLocation = $this->locationService->loadLocation(array_pop($groupLocationParts)); $userGroup = $this->userService->loadUserGroup($groupLocation->contentId); $role = $this->roleService->loadRole($roleId); $this->roleService->unassignRoleFromUserGroup($role, $userGroup); $roleAssignments = $this->roleService->getRoleAssignmentsForUserGroup($userGroup); return new Values\RoleAssignmentList($roleAssignments, $groupPath, true); }
/** * removes a role from the given user group. * * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to remove a role * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If the role is not assigned to the given user group * * @param \eZ\Publish\API\Repository\Values\User\Role $role * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup */ public function unassignRoleFromUserGroup(Role $role, UserGroup $userGroup) { $returnValue = $this->service->unassignRoleFromUserGroup($role, $userGroup); $this->signalDispatcher->emit(new UnassignRoleFromUserGroupSignal(array('roleId' => $role->id, 'userGroupId' => $userGroup->id))); return $returnValue; }