private function getWriteUGroups(Project $project) { $user_groups = $this->user_group_factory->getAllForProject($project); $write_ugroups = array(); $selected_ugroups = $this->manager->getWriteAccessControl($project); foreach ($user_groups as $ugroup) { $write_ugroups[] = array('label' => $ugroup->getName(), 'value' => $ugroup->getId(), 'selected' => in_array($ugroup->getId(), $selected_ugroups)); } return $write_ugroups; }
private function getOptions(Project $project, $permission) { $user_groups = $this->user_group_factory->getAllForProject($project); $options = array(); $selected_values = $this->permissions_manager->getAuthorizedUGroupIdsForProject($project, $this->repository->getId(), $permission); foreach ($user_groups as $ugroup) { if ($ugroup->getId() == ProjectUGroup::ANONYMOUS && $permission !== Git::PERM_READ) { continue; } $selected = in_array($ugroup->getId(), $selected_values) ? 'selected="selected"' : ''; $options[] = array('value' => $ugroup->getId(), 'label' => $ugroup->getName(), 'selected' => $selected); } return $options; }