示例#1
0
 /**
  * Return if the user can assign scrum user stories
  *
  * @param \thebuggenie\core\entities\Project $project
  *
  * @return boolean
  */
 public function canAssignScrumUserStories(\thebuggenie\core\entities\Project $project)
 {
     if ($project->isArchived()) {
         return false;
     }
     if ($this->canSaveConfiguration(framework\Settings::CONFIGURATION_SECTION_PROJECTS)) {
         return true;
     }
     if ($project->getOwner() instanceof User && $project->getOwner()->getID() == $this->getID()) {
         return true;
     }
     $retval = $this->hasPermission('canassignscrumuserstoriestosprints', $project->getID());
     $retval = $retval !== null ? $retval : $this->hasPermission('candoscrumplanning', $project->getID());
     $retval = $retval !== null ? $retval : $this->hasPermission('canassignscrumuserstoriestosprints', 0);
     $retval = $retval !== null ? $retval : $this->hasPermission('candoscrumplanning', 0);
     return (bool) ($retval !== null) ? $retval : false;
 }
示例#2
0
 /**
  * Check whether the user can access the specified project page
  *
  * @param string $page The page key
  * @param Project $project
  *
  * @return boolean
  */
 public function hasProjectPageAccess($page, Project $project)
 {
     $retval = $this->hasPageAccess($page, $project->getID());
     $retval = $retval === null ? $this->hasPageAccess('project_allpages', $project->getID()) : $retval;
     if ($retval === null) {
         if ($project->getOwner() instanceof User && $project->getOwner()->getID() == $this->getID()) {
             return true;
         }
         if ($project->getLeader() instanceof User && $project->getLeader()->getID() == $this->getID()) {
             return true;
         }
     }
     return $retval !== null ? $retval : framework\Settings::isPermissive();
 }