コード例 #1
0
 /**
  * Get a project repository by its id
  *
  * @return GitRepository the repository or null if not found
  */
 public function getRepositoryByIdUserCanSee(PFUser $user, $id)
 {
     if ($id == GitRepositoryGitoliteAdmin::ID) {
         return new GitRepositoryGitoliteAdmin();
     }
     $dar = $this->dao->searchProjectRepositoryById($id);
     $repository = $this->getRepositoryFromDar($dar);
     if ($repository === null) {
         throw new GitRepoNotFoundException();
     }
     $project = $repository->getProject();
     $url_verification = new URLVerification();
     try {
         $url_verification->userCanAccessProject($user, $project);
     } catch (Exception $exception) {
         throw $exception;
     }
     if (!$repository->userCanRead($user)) {
         throw new GitRepoNotReadableException();
     }
     return $repository;
 }
コード例 #2
0
 /**
  * Get a project repository by its id
  *
  * @param int $id         The id of the repository to load
  *
  * @return GitRepository the repository or null if not found
  */
 public function getRepositoryById($id)
 {
     $dar = $this->dao->searchProjectRepositoryById($id);
     return $this->getRepositoryFromDar($dar);
 }