BUG-13425 Cambiar el tamanio del campo PASSWORD, tabla AUTHENTICATION_SOURCE en la bd RBAC.

Se realizo un cambio en el schema de la BD Rbac para que el campo Password de la tabla AUTHENTICATION_SOURCE tenga un tamanio mayor de 150 caracteres.

Ademas de esto se realizaron cambios en la clase WsTools para poder hacer el cambio en el schema de la bd actual al realizar un upgrade.
Please enter the commit message for your changes. Lines starting
This commit is contained in:
jennylee
2013-11-21 09:10:42 -04:00
parent ddc9dbcd67
commit 0a9f3708cb
3 changed files with 50 additions and 11 deletions

View File

@@ -199,7 +199,7 @@
<column name="AUTH_SOURCE_BASE_DN" type="VARCHAR" size="128" required="true" default="" /> <column name="AUTH_SOURCE_BASE_DN" type="VARCHAR" size="128" required="true" default="" />
<column name="AUTH_ANONYMOUS" type="INTEGER" default="0" /> <column name="AUTH_ANONYMOUS" type="INTEGER" default="0" />
<column name="AUTH_SOURCE_SEARCH_USER" type="VARCHAR" size="128" required="true" default="" /> <column name="AUTH_SOURCE_SEARCH_USER" type="VARCHAR" size="128" required="true" default="" />
<column name="AUTH_SOURCE_PASSWORD" type="VARCHAR" size="32" required="true" default="" /> <column name="AUTH_SOURCE_PASSWORD" type="VARCHAR" size="150" required="true" default="" />
<column name="AUTH_SOURCE_ATTRIBUTES" type="VARCHAR" size="255" required="true" default="" /> <column name="AUTH_SOURCE_ATTRIBUTES" type="VARCHAR" size="255" required="true" default="" />
<column name="AUTH_SOURCE_OBJECT_CLASSES" type="VARCHAR" size="255" required="true" default="" /> <column name="AUTH_SOURCE_OBJECT_CLASSES" type="VARCHAR" size="255" required="true" default="" />
<column name="AUTH_SOURCE_DATA" type="LONGVARCHAR" /> <column name="AUTH_SOURCE_DATA" type="LONGVARCHAR" />

View File

@@ -682,6 +682,16 @@ class System
return System::getSchema( PATH_TRUNK . "workflow/engine/config/schema.xml" ); return System::getSchema( PATH_TRUNK . "workflow/engine/config/schema.xml" );
} }
/**
* Retrieves the system schema rbac.
*
* @return schema content in an array
*/
public static function getSystemSchemaRbac ()
{
return System::getSchema( PATH_TRUNK . "rbac/engine/config/schema.xml" );
}
/** /**
* Retrieves the schema for a plugin. * Retrieves the schema for a plugin.
* *

View File

@@ -134,6 +134,12 @@ class workspaceTools
$this->dbHost = $values["DB_HOST"]; $this->dbHost = $values["DB_HOST"];
$this->dbUser = $values["DB_USER"]; $this->dbUser = $values["DB_USER"];
$this->dbPass = $values["DB_PASS"]; $this->dbPass = $values["DB_PASS"];
$this->dbRbacHost = $values["DB_RBAC_HOST"];
$this->dbRbacName = $values["DB_RBAC_NAME"];
$this->dbRbacUser = $values["DB_RBAC_USER"];
$this->dbRbacPass = $values["DB_RBAC_PASS"];
return $this->dbInfo = $values; return $this->dbInfo = $values;
} }
@@ -330,13 +336,18 @@ class workspaceTools
* *
* @return database connection * @return database connection
*/ */
private function getDatabase() private function getDatabase($rbac = false)
{ {
if (isset($this->db) && $this->db->isConnected()) { if (isset($this->db) && $this->db->isConnected()) {
return $this->db; return $this->db;
} }
G::LoadSystem('database_' . strtolower($this->dbAdapter)); G::LoadSystem('database_' . strtolower($this->dbAdapter));
if ($rbac = true){
$this->db = new database($this->dbAdapter, $this->dbRbacHost, $this->dbRbacUser, $this->dbRbacPass, $this->dbRbacName);
} else {
$this->db = new database($this->dbAdapter, $this->dbHost, $this->dbUser, $this->dbPass, $this->dbName); $this->db = new database($this->dbAdapter, $this->dbHost, $this->dbUser, $this->dbPass, $this->dbName);
}
if (!$this->db->isConnected()) { if (!$this->db->isConnected()) {
$this->db->logQuery('No available connection to database!'); $this->db->logQuery('No available connection to database!');
throw new Exception("Could not connect to database"); throw new Exception("Could not connect to database");
@@ -370,9 +381,15 @@ class workspaceTools
* *
* @return array with the database schema * @return array with the database schema
*/ */
public function getSchema() public function getSchema($rbac = null)
{ {
if($rbac == null){
$oDataBase = $this->getDatabase(); $oDataBase = $this->getDatabase();
} else {
$oDataBase = $this->getDatabase(true);
}
$aOldSchema = array(); $aOldSchema = array();
@@ -632,7 +649,9 @@ class workspaceTools
$this->initPropel( true ); $this->initPropel( true );
p11835::isApplicable(); p11835::isApplicable();
$systemSchema = System::getSystemSchema(); $systemSchema = System::getSystemSchema();
$systemSchemaRbac = System::getSystemSchemaRbac();// obtiene el Schema de Rbac
$this->upgradeSchema( $systemSchema ); $this->upgradeSchema( $systemSchema );
$this->upgradeSchema( $systemSchemaRbac, false, true );// Hace Upgrade de Rbac
$this->upgradeData(); $this->upgradeData();
p11835::execute(); p11835::execute();
return true; return true;
@@ -646,7 +665,7 @@ class workspaceTools
* @return array bool the changes if checkOnly is true, else return * @return array bool the changes if checkOnly is true, else return
* true on success * true on success
*/ */
public function upgradeSchema($schema, $checkOnly = false) public function upgradeSchema($schema, $checkOnly = false, $rbac = false)
{ {
$dbInfo = $this->getDBInfo(); $dbInfo = $this->getDBInfo();
@@ -654,9 +673,16 @@ class workspaceTools
throw new Exception("Only MySQL is supported"); throw new Exception("Only MySQL is supported");
} }
if($rbac == true) {
$workspaceSchema = $this->getSchema(true);
} else {
$workspaceSchema = $this->getSchema(); $workspaceSchema = $this->getSchema();
}
$changes = System::compareSchema($workspaceSchema, $schema); $changes = System::compareSchema($workspaceSchema, $schema);
$changed = (count($changes['tablesToAdd']) > 0 || count($changes['tablesToAlter']) > 0 || count($changes['tablesWithNewIndex']) > 0 || count($changes['tablesToAlterIndex']) > 0); $changed = (count($changes['tablesToAdd']) > 0 || count($changes['tablesToAlter']) > 0 || count($changes['tablesWithNewIndex']) > 0 || count($changes['tablesToAlterIndex']) > 0);
if ($checkOnly || (!$changed)) { if ($checkOnly || (!$changed)) {
if ($changed) { if ($changed) {
return $changes; return $changes;
@@ -665,8 +691,11 @@ class workspaceTools
return $changed; return $changed;
} }
} }
if($rbac == true) {
$oDataBase = $this->getDatabaseRbac();
} else {
$oDataBase = $this->getDatabase(); $oDataBase = $this->getDatabase();
}
$oDataBase->iFetchType = MYSQL_NUM; $oDataBase->iFetchType = MYSQL_NUM;
$oDataBase->logQuery(count($changes)); $oDataBase->logQuery(count($changes));