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; }
/** * @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; }
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; }