コード例 #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();
 }
コード例 #2
0
 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;
 }
コード例 #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;
 }
コード例 #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;
 }