From 0a9f3708cb2f807cd5fbc05f44547cad0bac0b1f Mon Sep 17 00:00:00 2001 From: jennylee Date: Thu, 21 Nov 2013 09:10:42 -0400 Subject: [PATCH 1/3] 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 --- rbac/engine/config/schema.xml | 2 +- workflow/engine/classes/class.system.php | 10 +++++ workflow/engine/classes/class.wsTools.php | 49 ++++++++++++++++++----- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/rbac/engine/config/schema.xml b/rbac/engine/config/schema.xml index 2fc6b8b87..3c7807171 100755 --- a/rbac/engine/config/schema.xml +++ b/rbac/engine/config/schema.xml @@ -199,7 +199,7 @@ - + diff --git a/workflow/engine/classes/class.system.php b/workflow/engine/classes/class.system.php index b03495e62..4a90da7b1 100755 --- a/workflow/engine/classes/class.system.php +++ b/workflow/engine/classes/class.system.php @@ -682,6 +682,16 @@ class System 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. * diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index ba91be406..fe238ecdd 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -134,6 +134,12 @@ class workspaceTools $this->dbHost = $values["DB_HOST"]; $this->dbUser = $values["DB_USER"]; $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; } @@ -330,20 +336,25 @@ class workspaceTools * * @return database connection */ - private function getDatabase() - { + private function getDatabase($rbac = false) + { if (isset($this->db) && $this->db->isConnected()) { return $this->db; } + G::LoadSystem('database_' . strtolower($this->dbAdapter)); - $this->db = new database($this->dbAdapter, $this->dbHost, $this->dbUser, $this->dbPass, $this->dbName); + 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); + } if (!$this->db->isConnected()) { $this->db->logQuery('No available connection to database!'); throw new Exception("Could not connect to database"); } return $this->db; } - + /** * Close any database opened with getDatabase */ @@ -370,9 +381,15 @@ class workspaceTools * * @return array with the database schema */ - public function getSchema() + public function getSchema($rbac = null) { - $oDataBase = $this->getDatabase(); + + + if($rbac == null){ + $oDataBase = $this->getDatabase(); + } else { + $oDataBase = $this->getDatabase(true); + } $aOldSchema = array(); @@ -632,7 +649,9 @@ class workspaceTools $this->initPropel( true ); p11835::isApplicable(); $systemSchema = System::getSystemSchema(); + $systemSchemaRbac = System::getSystemSchemaRbac();// obtiene el Schema de Rbac $this->upgradeSchema( $systemSchema ); + $this->upgradeSchema( $systemSchemaRbac, false, true );// Hace Upgrade de Rbac $this->upgradeData(); p11835::execute(); return true; @@ -646,7 +665,7 @@ class workspaceTools * @return array bool the changes if checkOnly is true, else return * true on success */ - public function upgradeSchema($schema, $checkOnly = false) + public function upgradeSchema($schema, $checkOnly = false, $rbac = false) { $dbInfo = $this->getDBInfo(); @@ -654,9 +673,16 @@ class workspaceTools throw new Exception("Only MySQL is supported"); } - $workspaceSchema = $this->getSchema(); + if($rbac == true) { + $workspaceSchema = $this->getSchema(true); + } else { + $workspaceSchema = $this->getSchema(); + } + $changes = System::compareSchema($workspaceSchema, $schema); + $changed = (count($changes['tablesToAdd']) > 0 || count($changes['tablesToAlter']) > 0 || count($changes['tablesWithNewIndex']) > 0 || count($changes['tablesToAlterIndex']) > 0); + if ($checkOnly || (!$changed)) { if ($changed) { return $changes; @@ -665,8 +691,11 @@ class workspaceTools return $changed; } } - - $oDataBase = $this->getDatabase(); + if($rbac == true) { + $oDataBase = $this->getDatabaseRbac(); + } else { + $oDataBase = $this->getDatabase(); + } $oDataBase->iFetchType = MYSQL_NUM; $oDataBase->logQuery(count($changes)); From bbcbca67cdd525bbe4c8177594f81a08831d6c8e Mon Sep 17 00:00:00 2001 From: jennylee Date: Fri, 22 Nov 2013 13:54:30 -0400 Subject: [PATCH 2/3] 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 --- workflow/engine/classes/class.wsTools.php | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index fe238ecdd..51af76379 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -337,7 +337,7 @@ class workspaceTools * @return database connection */ private function getDatabase($rbac = false) - { + { if (isset($this->db) && $this->db->isConnected()) { return $this->db; } @@ -381,11 +381,9 @@ class workspaceTools * * @return array with the database schema */ - public function getSchema($rbac = null) + public function getSchema($rbac = false) { - - - if($rbac == null){ + if($rbac == false){ $oDataBase = $this->getDatabase(); } else { $oDataBase = $this->getDatabase(true); @@ -673,11 +671,7 @@ class workspaceTools throw new Exception("Only MySQL is supported"); } - if($rbac == true) { - $workspaceSchema = $this->getSchema(true); - } else { - $workspaceSchema = $this->getSchema(); - } + $workspaceSchema = $this->getSchema($rbac); $changes = System::compareSchema($workspaceSchema, $schema); @@ -691,11 +685,9 @@ class workspaceTools return $changed; } } - if($rbac == true) { - $oDataBase = $this->getDatabaseRbac(); - } else { - $oDataBase = $this->getDatabase(); - } + + $oDataBase = $this->getDatabase($rbac); + $oDataBase->iFetchType = MYSQL_NUM; $oDataBase->logQuery(count($changes)); From bf683e1ab518973db57a12126e1a28fa73b6889a Mon Sep 17 00:00:00 2001 From: jennylee Date: Fri, 22 Nov 2013 15:15:46 -0400 Subject: [PATCH 3/3] 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 --- workflow/engine/classes/class.wsTools.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 51af76379..fd908524e 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -383,11 +383,7 @@ class workspaceTools */ public function getSchema($rbac = false) { - if($rbac == false){ - $oDataBase = $this->getDatabase(); - } else { - $oDataBase = $this->getDatabase(true); - } + $oDataBase = $this->getDatabase($rbac); $aOldSchema = array();