Exemplo n.º 1
0
 /**
  * 
  */
 protected function loadUserPopo()
 {
     parent::loadUserPopo();
     $stmntUser = $this->db->prepare("\n\t\t\tSELECT username FROM " . $this->settings['db_login_table'] . " WHERE ID = ?\n\t\t");
     $resUser = $this->db->select($stmntUser, array($this->loginPopo->ID));
     if (count($resUser) === 1) {
         $userData = $resUser[0];
         $this->loginPopo->username = $userData->username;
     }
     $this->loginPopo->rightgroups = $this->loadRightGroups($this->loginPopo->ID);
     $this->cmsRights = $this->loadCmsRights();
 }
Exemplo n.º 2
0
 /**
  * Checks if a user has one of the given cms right (XOR) and throw exception if not
  * @param array|string $rights Single right or array of rights
  * @throws \ch\timesplinter\core\HttpException
  */
 public function abortIfUserHasNotRights($rights)
 {
     foreach ((array) $rights as $r) {
         if ($this->auth->hasCmsRight($r) === true) {
             return;
         }
     }
     if (count($this->auth->getCmsRights()) !== 0) {
         $currentRights = implode(', ', $this->auth->getCmsRights());
     } else {
         $currentRights = 'no rights yet';
     }
     throw new HttpException('You have not the required rights for this action. Required right is one of: ' . implode(', ', (array) $rights) . '. You\'re current rights: ' . $currentRights, 401);
 }