Ejemplo n.º 1
0
 /**
  * Based constructor for RBAC rules
  *
  * @access public
  *
  * @param Adapter $connection
  *
  * @result void
  */
 public function __construct(Adapter $connection)
 {
     $this->db = $connection->getDriver();
     if (!$this->db->tableExists('rbac_user')) {
         $this->db->createTable('rbac_user', ['`role` varchar(127) NOT NULL', '`user` int(10) unsigned NOT NULL', 'UNIQUE KEY `name` (`name`,`user`)'], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     }
 }
Ejemplo n.º 2
0
 /**
  * Base constructor for ACL, make acl_user table if exists
  *
  * @access public
  *
  * @param Adapter $db
  * @param array $params config array
  *
  * @result void
  */
 public function __construct(Adapter $db, array $params = [])
 {
     $this->db = $db->getDriver();
     if (!empty($params['groupTable'])) {
         $this->groupTable = $params['groupTable'];
     }
     if (!$this->db->tableExists('acl_user')) {
         $this->db->createTable('acl_user', ['`id` int(10) unsigned NOT NULL AUTO_INCREMENT', '`user` int(11) unsigned NOT NULL', '`role` int(11) unsigned DEFAULT NULL', '`perm` int(11) unsigned DEFAULT NULL', 'PRIMARY KEY (`id`)'], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     }
 }
Ejemplo n.º 3
0
 /**
  * @inheritdoc
  */
 public function check()
 {
     return $this->driver instanceof IDriver && $this->driver->tableExists($this->table) ?: false;
 }