Exemplo n.º 1
0
 public function setup()
 {
     $this->_sql = Solar::factory('Solar_Sql', array('adapter' => 'Solar_Sql_Adapter_Sqlite', 'name' => ':memory:'));
     $cmd = "\n            CREATE TABLE roles (\n                  handle VARCHAR(255)\n                 ,name CHAR(32)\n            )";
     $this->_sql->query($cmd);
     $roles = parse_ini_file(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'roles.ini', true);
     foreach ($roles as $role => $val) {
         $handles = explode(',', $val['handles']);
         $insert = array();
         foreach ($handles as $handle) {
             $data['handle'] = trim($handle);
             $data['name'] = $role;
             $this->_sql->insert('roles', $data);
         }
     }
     $this->_config['table'] = 'roles';
     $this->_config['handle_col'] = 'handle';
     $this->_config['role_col'] = 'name';
     $this->_config['sql'] = $this->_sql;
     parent::setup();
 }
Exemplo n.º 2
0
 public function setup()
 {
     $this->_config['file'] = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'roles.txt';
     parent::setup();
 }