Esempio n. 1
0
 /**
  * You can override this to provide custom database connection setting
  * @returns \jf\DatabaseSetting
  */
 function dbConfig()
 {
     if (self::$config === null) {
         $dbConfig = DatabaseManager::Configuration();
         $newConfig = new \jf\DatabaseSetting($dbConfig->Adapter, $dbConfig->DatabaseName, $dbConfig->Username, $dbConfig->Password, $dbConfig->Host, $dbConfig->TablePrefix . "_test_");
         self::$config = $newConfig;
     }
     return self::$config;
 }
Esempio n. 2
0
 /**
  * Remove all role-permission relations
  * mostly used for testing
  * 
  * @param boolean $Ensure
  *        	must set or throws error
  * @return number of deleted relations
  */
 function ResetAssignments($Ensure = false)
 {
     if ($Ensure !== true) {
         throw new \Exception("You must pass true to this function, otherwise it won't work.");
         return;
     }
     $res = jf::SQL("DELETE FROM {$this->TablePrefix()}rbac_rolepermissions");
     $Adapter = DatabaseManager::Configuration()->Adapter;
     if ($Adapter == "mysqli" or $Adapter == "pdo_mysql") {
         jf::SQL("ALTER TABLE {$this->TablePrefix()}rbac_rolepermissions AUTO_INCREMENT =1 ");
     } elseif ($Adapter == "pdo_sqlite") {
         jf::SQL("delete from sqlite_sequence where name=? ", $this->TablePrefix() . "_rbac_rolepermissions");
     } else {
         throw new \Exception("RBAC can not reset table on this type of database: {$Adapter}");
     }
     $this->Assign("root", "root");
     return $res;
 }
Esempio n. 3
0
 static function TablePrefix()
 {
     return DatabaseManager::Configuration()->TablePrefix;
 }