Ejemplo n.º 1
0
 public function __construct(DataRow $row)
 {
     if ($row->getTable()->getTableName() !== DB::getRoleTableName()) {
         throw new SystemException('Wrong Role Table');
     }
     $this->_data = $row->getAllData();
     //load permission
     $this->loadPermission();
 }
 public static function getAllPermissions()
 {
     static $permissions;
     if (!isset($permissions)) {
         $permissions = array();
         $result = DBAL::select(DB::getPermissionTableName())->execute();
         foreach ($result as $dataRow) {
             $permissions[$dataRow->get('role_id')] = explode(',', $dataRow['permissions']);
         }
     }
     return $permissions;
 }
Ejemplo n.º 3
0
 /**
  * @return \ORC\App\User\Roles
  */
 public static function getAllRoles()
 {
     static $roles;
     if (!isset($roles)) {
         $roles = new self();
         $dbal = DBAL::select(DB::getRoleTableName());
         $result = $dbal->execute();
         foreach ($result as $row) {
             $role = new Role($row);
             //$this->_roles[$role->getId()] = $role;
             $roles[$role->getId()] = $role;
         }
     }
     return $roles;
 }
Ejemplo n.º 4
0
 public function autoLogin($id)
 {
     $this->flushRoles();
     $dbal = DBAL::select(DB::getUserTableName())->pk($id);
     $result = $dbal->getOne();
     if ($result instanceof \ORC\DAO\Table\DataRow) {
         $this->_data = $result->getAllData();
         return true;
     }
     return false;
 }