/** * * @see session_continue * * @param String $session_key * * @return User */ public function continueSession($session_key) { $user = $this->user_manager->getCurrentUser($session_key); if ($user->isLoggedIn()) { return $user; } throw new Exception('Invalid session', '3001'); }
/** * Launch the migration of a TV3 to a TV5 * * @param Project $project * @param $tracker_id * @param $name * @param $description * @param $short_name * * @return bool true if everything seems right */ public function askForMigration(Project $project, $tracker_id, $name, $description, $short_name) { if (!$this->tracker_factory->validMandatoryInfoOnCreate($name, $description, $short_name, $project->getGroupId())) { return false; } $this->system_event_manager->queueTV3Migration($this->user_manager->getCurrentUser(), $project, $tracker_id, $name, $description, $short_name); return true; }
/** * * @see session_continue * * @param String $sessionKey * * @return User */ private function continueSession($sessionKey) { $user = $this->userManager->getCurrentUser($sessionKey); if ($user->isLoggedIn()) { return $user; } throw new SoapFault('3001', 'Invalid session'); }
public function request() { $valid = new Valid_String('repo_name'); $valid->required(); $repositoryName = null; if ($this->request->valid($valid)) { $repositoryName = trim($this->request->get('repo_name')); } $valid = new Valid_UInt('repo_id'); $valid->required(); if ($this->request->valid($valid)) { $repoId = $this->request->get('repo_id'); } else { $repoId = 0; } $user = $this->userManager->getCurrentUser(); //define access permissions $this->definePermittedActions($repoId, $user); //check permissions if (empty($this->permittedActions) || !$this->isAPermittedAction($this->action)) { $this->addError($this->getText('controller_access_denied')); $this->redirect('/plugins/git/?group_id=' . $this->groupId); return; } $this->_informAboutPendingEvents($repoId); $this->_dispatchActionAndView($this->action, $repoId, $repositoryName, $user); }
private function logPriorityChange($moved_artifact_id, $artifact_higher_id, $artifact_lower_id, $context_id, $project_id, $old_global_rank) { $artifact = $this->tracker_artifact_factory->getArtifactById($moved_artifact_id); if ($artifact) { $tracker = $artifact->getTracker(); if ($tracker && $tracker->arePriorityChangesShown()) { $this->priority_history_dao->logPriorityChange($moved_artifact_id, $artifact_higher_id, $artifact_lower_id, $context_id, $project_id, $this->user_manager->getCurrentUser()->getId(), time(), $old_global_rank); } } }
private function filterOnProjectIds(array &$project_filter, array $group_ids) { foreach ($group_ids as $group_id) { if ($group_id === ElasticSearch_SearchResultProjectsFacetCollection::USER_PROJECTS_IDS_KEY) { $this->filterOnProjectIds($project_filter, $this->user_manager->getCurrentUser()->getProjects()); return; } $project_filter[] = array('term' => array('group_id' => (int) $group_id)); } }
public function getSearchResults(array $result) { $results = array(); $validator = new ElasticSearch_1_2_ResultValidator(); if (!isset($result['hits']['hits'])) { return $results; } $user = $this->user_manager->getCurrentUser(); foreach ($result['hits']['hits'] as $hit) { $project = $this->project_manager->getProject($this->extractGroupIdFromHit($hit)); $index = $this->extractIndexFromHit($hit); if ($project->isError()) { continue; } try { $this->url_verification->userCanAccessProject($user, $project); } catch (Project_AccessPrivateException $exception) { continue; } switch ($index) { case fulltextsearchPlugin::SEARCH_DOCMAN_TYPE: if (!$validator->isDocmanResultValid($hit)) { continue; } $results[] = new ElasticSearch_SearchResultDocman($hit, $project); break; case fulltextsearchPlugin::SEARCH_WIKI_TYPE: if (!$validator->isWikiResultValid($hit)) { continue; } $wiki = new Wiki($project->getID()); if ($wiki->isAutorized($user->getId())) { $results[] = new ElasticSearch_SearchResultWiki($hit, $project); } break; case fulltextsearchPlugin::SEARCH_TRACKER_TYPE: if (!$validator->isArtifactResultValid($hit)) { continue; } $artifact = Tracker_ArtifactFactory::instance()->getArtifactById($hit['fields']['id'][0]); if ($artifact->userCanView($user)) { $results[] = new ElasticSearch_SearchResultTracker($hit, $project, $artifact); } break; default: } } return $results; }
private function getMilestoneContentItems() { $backlog_item_collection_factory = new AgileDashboard_Milestone_Backlog_BacklogItemCollectionFactory(new AgileDashboard_BacklogItemDao(), $this->artifact_factory, $this->tracker_form_element_factory, $this->milestone_factory, $this->planning_factory, new AgileDashboard_Milestone_Backlog_BacklogItemBuilder()); $strategy_factory = new AgileDashboard_Milestone_Backlog_BacklogStrategyFactory(new AgileDashboard_BacklogItemDao(), $this->artifact_factory, $this->planning_factory); return $backlog_item_collection_factory->getAllCollection($this->user_manager->getCurrentUser(), $this->milestone, $strategy_factory->getSelfBacklogStrategy($this->milestone), ''); }
private function setCurrentUserIfUserIsNotDefined(&$user) { if (!isset($user)) { $user = $this->user_manager->getCurrentUser(); } }
public function __construct(UserManager $user_manager, Codendi_Request $request) { $this->user = $user_manager->getCurrentUser(); $this->request = $request; }