Beispiel #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');
     }
 }
Beispiel #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');
     }
 }
Beispiel #3
0
 /**
  * Send log message into DB
  *
  * @access public
  *
  * @param integer $level level number
  * @param string $message message to write
  *
  * @return void
  */
 public function sendMessage($level, $message)
 {
     $this->db->insert($this->tableName, ['level' => $level, 'message' => $message, 'date_create' => $_SERVER['REQUEST_TIME']]);
 }