Beispiel #1
0
 protected function adminGitAdminsView($is_admin_mass_change_allowed)
 {
     $params = $this->getData();
     $presenter = new GitPresenters_AdminGitAdminsPresenter($this->groupId, $is_admin_mass_change_allowed, $this->ugroup_manager->getStaticUGroups($this->project), $this->git_permissions_manager->getCurrentGitAdminUgroups($this->project->getId()));
     $renderer = TemplateRendererFactory::build()->getRenderer(dirname(GIT_BASE_DIR) . '/templates');
     echo $renderer->renderToString('admin', $presenter);
 }
 /**
  * @param  Project $project
  * @param  PFUser  $user
  *
  * @throws GitUserNotAdminException
  */
 private function checkUserIsAdmin(Project $project, PFUser $user)
 {
     if (!$this->git_permissions_manager->userIsGitAdmin($user, $project)) {
         throw new GitUserNotAdminException('unable to get template', 401);
     }
     return true;
 }
Beispiel #3
0
 public function _doDispatchForkCrossProject($request, $user)
 {
     $this->checkSynchronizerToken('/plugins/git/?group_id=' . (int) $this->groupId . '&action=fork_repositories');
     $validators = array(new Valid_UInt('to_project'), new Valid_String('repos'), new Valid_Array('repo_access'));
     foreach ($validators as $validator) {
         $validator->required();
         if (!$request->valid($validator)) {
             $this->addError($this->getText('missing_parameter_' . $validator->key));
             $this->redirect('/plugins/git/?group_id=' . $this->groupId);
             return;
         }
     }
     $to_project_id = $request->get('to_project');
     if ($this->permissions_manager->userIsGitAdmin($user, $this->projectManager->getProject($to_project_id))) {
         $to_project = $this->projectManager->getProject($to_project_id);
         $repos_ids = explode(',', $request->get('repos'));
         $repos = $this->getRepositoriesFromIds($repos_ids);
         $namespace = '';
         $scope = GitRepository::REPO_SCOPE_PROJECT;
         $redirect_url = '/plugins/git/?group_id=' . (int) $to_project_id;
         $forkPermissions = $this->getForkPermissionsFromRequest($request);
         $this->addAction('fork', array($repos, $to_project, $namespace, $scope, $user, $GLOBALS['HTML'], $redirect_url, $forkPermissions));
     } else {
         $this->addError($this->getText('must_be_admin_to_create_project_repo'));
     }
 }