public function build($project_id, $is_used_by_default, array $ugroups) { $ugroup_representations = array(); foreach ($ugroups as $user_group) { $ugroup_representation = new UserGroupRepresentation(); $ugroup_representation->build($project_id, $user_group); $ugroup_representations[] = $ugroup_representation; } $this->is_used_by_default = $is_used_by_default; $this->ugroup_representations = $ugroup_representations; }
private function buildUGroupRepresentations(GitRepository $repository, $ugroup_rows) { $ugroup_representations = array(); foreach ($ugroup_rows as $row) { $ugroup = $this->ugroup_manager->getById($row['ugroup_id']); $rewind_ugroup_representation = new UserGroupRepresentation(); $rewind_ugroup_representation->build($repository->getProjectId(), $ugroup); $ugroup_representations[] = $rewind_ugroup_representation; } return $ugroup_representations; }
/** * Get a user_group * * Get the definition of a given user_group * * @url GET {id} * @access hybrid * * @param string $id Id of the ugroup This should be one of two formats<br> * - format: projectId_ugroupId for dynamic project user groups (project members...)<br> * - format: ugroupId for all other groups (registered users, custom groups, ...) * * @throws 400 * @throws 403 * @throws 404 * * @return \Tuleap\Project\REST\UserGroupRepresentation */ public function getId($id) { $this->checkAccess(); $ugroup = $this->getExistingUserGroup($id); $project_id = $ugroup->getProjectId(); if ($project_id) { $this->userCanSeeUserGroups($project_id); } $ugroup_representation = new UserGroupRepresentation(); $ugroup_representation->build($project_id, $ugroup); $this->sendAllowHeadersForUserGroup(); return $ugroup_representation; }
/** * Get a user_group * * Get the definition of a given user_group * * @url GET {id} * @access protected * * @param string $id Id of the ugroup (format: projectId_ugroupId) * * @throws 400 * @throws 403 * @throws 404 * * @return \Tuleap\Project\REST\UserGroupRepresentation */ protected function getId($id) { $this->checkIdIsWellFormed($id); list($project_id, $ugroup_id) = explode('_', $id); $this->isGroupViewable($ugroup_id); $this->checkUserGroupIdExists($ugroup_id); $this->userCanSeeUserGroups($project_id); $ugroup = $this->ugroup_manager->getById($ugroup_id); $ugroup_representation = new UserGroupRepresentation(); $ugroup_representation->build($project_id, $ugroup); $this->sendAllowHeadersForUserGroup(); return $ugroup_representation; }
private function getUserGroupsRepresentations(array $ugroups, $project_id) { $user_groups = array(); foreach ($ugroups as $ugroup) { $representation = new UserGroupRepresentation(); $representation->build($project_id, $ugroup); $user_groups[] = $representation; } return $user_groups; }