本文整理汇总了PHP中UserManager::getCurrentUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManager::getCurrentUser方法的具体用法?PHP UserManager::getCurrentUser怎么用?PHP UserManager::getCurrentUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserManager
的用法示例。
在下文中一共展示了UserManager::getCurrentUser方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: continueSession
/**
*
* @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');
}
示例2: askForMigration
/**
* 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;
}
示例3: continueSession
/**
*
* @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');
}
示例4: request
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);
}
示例5: logPriorityChange
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);
}
}
}
示例6: filterOnProjectIds
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));
}
}
示例7: getSearchResults
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;
}
示例8: getMilestoneContentItems
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), '');
}
示例9: setCurrentUserIfUserIsNotDefined
private function setCurrentUserIfUserIsNotDefined(&$user)
{
if (!isset($user)) {
$user = $this->user_manager->getCurrentUser();
}
}
示例10: __construct
public function __construct(UserManager $user_manager, Codendi_Request $request)
{
$this->user = $user_manager->getCurrentUser();
$this->request = $request;
}