Example #1
0
 /**
  * Load the internal account
  */
 public function loadInternalAccount()
 {
     $emI = $this->core->getInternalDatabase()->getEntityManager();
     $this->currentInternalAccount = $emI->getRepository('\\Quantum\\DBO\\InternalAccount')->findOneBy(array('accountId' => $this->currentAccount->getId()));
     if ($this->currentInternalAccount == null) {
         return;
     }
     // Load groups
     $userGroups = $emI->getRepository('\\Quantum\\DBO\\UserGroup')->findBy(array('userId' => $this->currentInternalAccount->getId()));
     /** @var $userGroup UserGroup */
     foreach ($userGroups as $userGroup) {
         $this->groups[] = $emI->find('\\Quantum\\DBO\\Group', $userGroup->getGroupId());
     }
     // Load privileges
     /** @var $group Group */
     foreach ($this->groups as $group) {
         $groupPrivileges = $emI->getRepository('\\Quantum\\DBO\\GroupPrivilege')->findBy(array('groupId' => $group->getId()));
         /** @var $groupPrivilege GroupPrivilege */
         foreach ($groupPrivileges as $groupPrivilege) {
             /** @var $privilege Privilege */
             $privilege = $emI->find('\\Quantum\\DBO\\Privilege', $groupPrivilege->getId());
             $this->stringPrivileges[] = $privilege->getTechnicalName();
             $this->privileges[] = $privilege;
         }
     }
 }