public function pxlistAction() { $initialized = $this->initialize(); if ($initialized !== true) { return $initialized; } if (!$this->auth->hasIdentity()) { return $this->redirect()->toRoute('login'); } elseif (!$this->is_domain_admin) { return $this->redirect()->toRoute('publisher'); } $publisher_id = intval($this->params()->fromRoute('param1', 0)); $PublisherInfoFactory = \_factory\PublisherInfo::get_instance(); $params = array(); $params["PublisherInfoID"] = $publisher_id; $PublisherInfo = $PublisherInfoFactory->get_row($params); if (!$PublisherInfo) { die("Publisher Not Found: CODE 103"); } $authUsersFactory = \_factory\authUsers::get_instance(); $params = array(); $params["PublisherInfoID"] = $PublisherInfo->PublisherInfoID; $authUserChild = $authUsersFactory->get_row($params); if (!$authUserChild) { die("Publisher Not Found: CODE 104"); } if (!\util\AuthHelper::domain_user_authorized($this->auth->getUserID(), $authUserChild->user_id)) { die("Not Authorized: CODE 105"); } $PublisherWebsiteFactory = \_factory\PublisherWebsite::get_instance(); $orders = 'DateCreated DESC'; $params = array(); $params["DomainOwnerID"] = $PublisherInfo->PublisherInfoID; $pending_list = $PublisherWebsiteFactory->get($params, $orders); $view = new ViewModel(array('dashboard_view' => 'account', 'pending_list' => $pending_list, 'PublisherInfoFactory' => $PublisherInfoFactory, 'vertical_map' => \util\DeliveryFilterOptions::$vertical_map, 'user_id_list' => $this->user_id_list, 'user_identity' => $this->identity(), 'true_user_name' => $this->auth->getUserName(), 'header_title' => 'Private Exchange Publisher Websites', 'is_domain_admin' => $this->is_domain_admin, 'effective_id' => $this->auth->getEffectiveIdentityID(), 'impersonate_id' => $this->ImpersonateID)); return $view; }
/** * Get the user's (identity object) ID that is to be used, * impersonated or real, depending on mode specified prior * or during the session. NULL will be returned ONLY if no user * is logged in. * * @return integer|NULL Returns the current active/selected user ID. */ public function getEffectiveUserID() { if ($this->debug && $this->debug_verbose) { echo "\n<div style=\"font-size: 75%;\"><a style=\"font-weight: bold;\">Attempting Impersonation to User ID:</a> " . $this->ImpersonateIdentityID . "</div>\n"; } if ($this->AdminRoleSuperAdmin && $this->ImpersonateIdentityID != null && $this->ImpersonateIdentityID != 0) { if ($this->debug) { echo "\n<div style=\"font-weight: bold; font-size: 75%;\">Impersonated User ID: " . $this->ImpersonateIdentityID . "</div>\n"; } return $this->ImpersonateIdentityID; } elseif ($this->AdminRoleDomainAdmin && $this->ImpersonateIdentityID != null && $this->ImpersonateIdentityID != 0) { if ($this->debug) { echo "\n<div style=\"font-weight: bold; font-size: 75%;\">Impersonated User ID: " . $this->ImpersonateIdentityID . "</div>\n"; } if (\util\AuthHelper::domain_user_authorized($this->TrueIdentityID, $this->ImpersonateIdentityID)) { return $this->ImpersonateIdentityID; } } else { if ($this->debug && $this->debug_verbose) { echo "\n<div style=\"font-size: 75%;\"><a style=\"font-weight: bold;\">Impersonation FAILED!</a></div>\n"; } return $this->TrueIdentityID; } }