Example #1
0
 /**
  * @param Git_Driver_Gerrit_Template_Template $template
  * @param Project $project
  * @param PFUser $user
  * @throws Git_ProjectNotInHierarchyException
  */
 private function checkTemplateIsAccessible(Git_Driver_Gerrit_Template_Template $template, Project $project, PFUser $user)
 {
     $template_id = $template->getId();
     foreach ($this->template_factory->getTemplatesAvailableForProject($project) as $available_template) {
         if ($available_template->getId() == $template_id) {
             $template_project = $this->project_manager->getProject($available_template->getProjectId());
             $this->checkUserIsAdmin($template_project, $user);
             return true;
         }
     }
     throw new Git_TemplateNotInProjectHierarchyException('Project not in hierarchy', 404);
 }
 /**
  * @param Git_Driver_Gerrit_Template_Template $template
  * @return bool
  */
 public function updateTemplate(Git_Driver_Gerrit_Template_Template $template)
 {
     return $this->dao->updateTemplate($template->getId(), $template->getName(), $template->getContent());
 }