예제 #1
0
 /**
  * Return an array of all IXP names where the array key is the IXP id.
  *
  * NOTE: Super user can see all IXPs and customer user can see only those which
  *         is assigned to the users customer.
  *
  * @param  \Entities\User $user User to limit IXP names
  * @return array An array of all IXP names with the IXP id as the key.
  */
 public function getNames($user)
 {
     $dql = "SELECT i.id AS id, i.name AS name FROM Entities\\IXP i";
     if ($user->getPrivs() != \Entities\User::AUTH_SUPERUSER) {
         $dql .= " WHERE ?1 MEMBER OF i.Customers";
     }
     $dql .= " ORDER BY name ASC";
     $query = $this->getEntityManager()->createQuery($dql);
     if ($user->getPrivs() != \Entities\User::AUTH_SUPERUSER) {
         $query->setParameter(1, $user->getCustomer()->getId());
     }
     $aixps = $query->getResult();
     $ixps = [];
     foreach ($aixps as $i) {
         $ixps[$i['id']] = $i['name'];
     }
     return $ixps;
 }
예제 #2
0
 public function getCustomer()
 {
     $this->__load();
     return parent::getCustomer();
 }
예제 #3
0
 /**
  * This function is called just before `switchUserBackAction()` actually switches
  * the user back.
  *
  * @param \Entities\User $subUser The current user we have switched to (substituted to)
  * @param \Entities\User $origUser The original user that we switched from
  * @return bool|array False if you want the switch back to fail.
  */
 protected function _switchUserBackCheck($subUser, $origUser)
 {
     // record current user customer ID
     $custid = $this->getUser()->custid;
     $params['url'] = 'customer/overview/tab/users/id/' . $subUser->getCustomer()->getId();
     return $params;
 }