Beispiel #1
0
 protected function getToolbar()
 {
     $GLOBALS['HTML']->addToolbarItem($this->linkTo($this->getText('bread_crumb_home'), '/plugins/git/?group_id=' . $this->groupId));
     $GLOBALS['HTML']->addToolbarItem($this->linkTo($this->getText('fork_repositories'), '/plugins/git/?group_id=' . $this->groupId . '&action=fork_repositories'));
     $GLOBALS['HTML']->addToolbarItem($this->linkTo($this->getText('bread_crumb_help'), 'javascript:help_window(\'/doc/' . $this->user->getShortLocale() . '/user-guide/git.html\')'));
     if ($this->git_permissions_manager->userIsGitAdmin($this->user, $this->project)) {
         $GLOBALS['HTML']->addToolbarItem($this->linkTo($this->getText('bread_crumb_admin'), '/plugins/git/?group_id=' . $this->groupId . '&action=admin'));
     }
 }
 /**
  * @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'));
     }
 }