Beispiel #1
0
 /**
  * Returns a list of the sub groups
  *
  * @param $groupPath
  *
  * @return \eZ\Publish\Core\REST\Server\Values\UserGroupList|\eZ\Publish\Core\REST\Server\Values\UserGroupRefList
  */
 public function loadSubUserGroups($groupPath)
 {
     $userGroupLocation = $this->locationService->loadLocation($this->extractLocationIdFromPath($groupPath));
     $userGroup = $this->userService->loadUserGroup($userGroupLocation->contentId);
     $subGroups = $this->userService->loadSubUserGroups($userGroup);
     $restUserGroups = array();
     foreach ($subGroups as $subGroup) {
         $subGroupContentInfo = $subGroup->getVersionInfo()->getContentInfo();
         $subGroupLocation = $this->locationService->loadLocation($subGroupContentInfo->mainLocationId);
         $contentType = $this->contentTypeService->loadContentType($subGroupContentInfo->contentTypeId);
         $restUserGroups[] = new Values\RestUserGroup($subGroup, $contentType, $subGroupContentInfo, $subGroupLocation, $this->contentService->loadRelations($subGroup->getVersionInfo()));
     }
     if ($this->getMediaType() === 'application/vnd.ez.api.usergrouplist') {
         return new Values\CachedValue(new Values\UserGroupList($restUserGroups, $this->request->getPathInfo()), array('locationId' => $userGroupLocation->id));
     }
     return new Values\CachedValue(new Values\UserGroupRefList($restUserGroups, $this->request->getPathInfo()), array('locationId' => $userGroupLocation->id));
 }
 /**
  * Loads the sub groups of a user group
  *
  * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup
  *
  * @return \eZ\Publish\API\Repository\Values\User\UserGroup[]
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read the user group
  */
 public function loadSubUserGroups(UserGroup $userGroup)
 {
     return $this->service->loadSubUserGroups($userGroup);
 }
Beispiel #3
0
 /**
  * Loads the sub groups of a user group.
  *
  * @param \eZ\Publish\API\Repository\Values\User\UserGroup $userGroup
  * @param int $offset the start offset for paging
  * @param int $limit the number of user groups returned
  *
  * @return \eZ\Publish\API\Repository\Values\User\UserGroup[]
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to read the user group
  */
 public function loadSubUserGroups(UserGroup $userGroup, $offset = 0, $limit = 25)
 {
     return $this->service->loadSubUserGroups($userGroup, $offset, $limit);
 }