Пример #1
0
 public function addObject($item)
 {
     if ($item instanceof User && $this->type != self::USERS) {
         GitoliteException::throwWrongTeamType($item->name, self::USERS);
     } elseif ($item instanceof Repo && $this->type != self::REPO) {
         GitoliteException::throwWrongTeamType($item->name, self::REPO);
     }
     $item->addTeam($this);
     $this->items[] = $item;
 }
Пример #2
0
 /**
  * @param $line
  *
  * @return Repo[]
  * @throws GitoliteException
  */
 protected function parseRepo($line)
 {
     $find = [];
     $arr = preg_split("/[\\s\t]+/", $line);
     array_shift($arr);
     foreach ($arr as $name) {
         if (self::isTeam($name)) {
             if (!($team = $this->getTeamAsRepo($name))) {
                 GitoliteException::throwUndefinedTeam($name);
             }
             $find = array_merge($find, $team->items);
         } else {
             $repo = new Repo();
             $repo->setName($name);
             $this->addRepo($repo);
             $find[] = $repo;
         }
     }
     return $find;
 }
Пример #3
0
 /**
  * Add Team
  *
  * @param Team $team A team object
  *
  * @return Acl
  */
 public function addTeam(Team $team)
 {
     if ($team->type != Team::USERS) {
         GitoliteException::throwWrongTeamType($team, Team::USERS);
     }
     foreach ($team->items as $item) {
         $this->addUser($item);
     }
     return $this;
 }