BUG-14726 Error al conectar ProcessMaker con un... SOLVED
- even filtered by type "SUPER". - add validation in intall also a check for use the current user
This commit is contained in:
@@ -1200,7 +1200,7 @@ class AppCacheView extends BaseAppCacheView
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM `information_schema`.`USER_PRIVILEGES`
|
||||
WHERE GRANTEE = \"'$mysqlUser'\" and PRIVILEGE_TYPE = 'SUPER' ";
|
||||
WHERE GRANTEE = \"'$mysqlUser'\" ";
|
||||
|
||||
$rs1 = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
$rs1->next();
|
||||
|
||||
@@ -562,8 +562,19 @@ class Installer extends Controller
|
||||
public function setGrantPrivilegesMySQL ($psUser, $psPassword, $psDatabase, $host)
|
||||
{
|
||||
$host = ($host == 'localhost' || $host == '127.0.0.1' ? 'localhost' : '%');
|
||||
$query = sprintf( "GRANT ALL PRIVILEGES ON `%s`.* TO %s@'%s' IDENTIFIED BY '%s' WITH GRANT OPTION", $psDatabase, $psUser, $host, $psPassword );
|
||||
$this->mysqlQuery( $query );
|
||||
$sql = sprintf( "GRANT ALL PRIVILEGES ON `%s`.* TO %s@'%s' IDENTIFIED BY '%s' WITH GRANT OPTION", $psDatabase, $psUser, $host, $psPassword );
|
||||
$query = @mysql_query( $sql, $this->link );
|
||||
if (! $query) {
|
||||
$errorMessage = mysql_error( $this->link );
|
||||
$this->installLog( G::LoadTranslation('ID_MYSQL_ERROR', SYS_LANG, Array($errorMessage) ) );
|
||||
if (mysql_errno( $this->link) == 1410 ){
|
||||
$errorMessage .= '. ' . G::LoadTranslation('ID_INSTALL_USE_CURRENT_USER');
|
||||
}
|
||||
throw new Exception( $errorMessage );
|
||||
return false;
|
||||
}
|
||||
@mysql_free_result( $query );
|
||||
$this->installLog( $sql );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -631,6 +642,7 @@ class Installer extends Controller
|
||||
$adminPassword = trim( $_REQUEST['adminPassword'] );
|
||||
$adminUsername = trim( $_REQUEST['adminUsername'] );
|
||||
$deleteDB = ($_REQUEST['deleteDB'] == 'true');
|
||||
$userLogged = ($_REQUEST['userLogged'] == 'true');
|
||||
|
||||
if (substr( $pathShared, - 1 ) != '/') {
|
||||
$pathShared .= '/';
|
||||
@@ -666,12 +678,25 @@ class Installer extends Controller
|
||||
$this->mysqlQuery( $q );
|
||||
|
||||
// CREATE users and GRANT Privileges
|
||||
$wfPass = G::generate_password( 12 );
|
||||
$rbPass = G::generate_password( 12 );
|
||||
$rpPass = G::generate_password( 12 );
|
||||
$this->setGrantPrivilegesMySQL( $wf, $wfPass, $wf, $db_hostname );
|
||||
$this->setGrantPrivilegesMySQL( $rb, $rbPass, $rb, $db_hostname );
|
||||
$this->setGrantPrivilegesMySQL( $rp, $rpPass, $rp, $db_hostname );
|
||||
$wf_workpace = $wf;
|
||||
$rb_workpace = $rb;
|
||||
$rp_workpace = $rp;
|
||||
if (!$userLogged) {
|
||||
$wfPass = G::generate_password( 12 );
|
||||
$rbPass = G::generate_password( 12 );
|
||||
$rpPass = G::generate_password( 12 );
|
||||
$this->setGrantPrivilegesMySQL( $wf, $wfPass, $wf, $db_hostname );
|
||||
$this->setGrantPrivilegesMySQL( $rb, $rbPass, $rb, $db_hostname );
|
||||
$this->setGrantPrivilegesMySQL( $rp, $rpPass, $rp, $db_hostname );
|
||||
} else {
|
||||
$wfPass = $db_password;
|
||||
$rbPass = $db_password;
|
||||
$rpPass = $db_password;
|
||||
$wf = $db_username;
|
||||
$rb = $db_username;
|
||||
$rp = $db_username;
|
||||
}
|
||||
|
||||
|
||||
// Generate the db.php file and folders
|
||||
$pathSharedSites = $pathShared;
|
||||
@@ -688,15 +713,15 @@ class Installer extends Controller
|
||||
$dbText .= sprintf( "// Processmaker configuration\n" );
|
||||
$dbText .= sprintf( " define ('DB_ADAPTER', '%s' );\n", 'mysql' );
|
||||
$dbText .= sprintf( " define ('DB_HOST', '%s' );\n", $db_host );
|
||||
$dbText .= sprintf( " define ('DB_NAME', '%s' );\n", $wf );
|
||||
$dbText .= sprintf( " define ('DB_NAME', '%s' );\n", $wf_workpace );
|
||||
$dbText .= sprintf( " define ('DB_USER', '%s' );\n", $wf );
|
||||
$dbText .= sprintf( " define ('DB_PASS', '%s' );\n", $wfPass );
|
||||
$dbText .= sprintf( " define ('DB_RBAC_HOST', '%s' );\n", $db_host );
|
||||
$dbText .= sprintf( " define ('DB_RBAC_NAME', '%s' );\n", $rb );
|
||||
$dbText .= sprintf( " define ('DB_RBAC_NAME', '%s' );\n", $rb_workpace );
|
||||
$dbText .= sprintf( " define ('DB_RBAC_USER', '%s' );\n", $rb );
|
||||
$dbText .= sprintf( " define ('DB_RBAC_PASS', '%s' );\n", $rbPass );
|
||||
$dbText .= sprintf( " define ('DB_REPORT_HOST', '%s' );\n", $db_host );
|
||||
$dbText .= sprintf( " define ('DB_REPORT_NAME', '%s' );\n", $rp );
|
||||
$dbText .= sprintf( " define ('DB_REPORT_NAME', '%s' );\n", $rp_workpace );
|
||||
$dbText .= sprintf( " define ('DB_REPORT_USER', '%s' );\n", $rp );
|
||||
$dbText .= sprintf( " define ('DB_REPORT_PASS', '%s' );\n", $rpPass );
|
||||
if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) {
|
||||
@@ -714,15 +739,15 @@ class Installer extends Controller
|
||||
$databases_file = $path_site . 'databases.php';
|
||||
$dbData = sprintf( "\$dbAdapter = '%s';\n", 'mysql' );
|
||||
$dbData .= sprintf( "\$dbHost = '%s';\n", $db_host );
|
||||
$dbData .= sprintf( "\$dbName = '%s';\n", $wf );
|
||||
$dbData .= sprintf( "\$dbName = '%s';\n", $wf_workpace );
|
||||
$dbData .= sprintf( "\$dbUser = '%s';\n", $wf );
|
||||
$dbData .= sprintf( "\$dbPass = '%s';\n", $wfPass );
|
||||
$dbData .= sprintf( "\$dbRbacHost = '%s';\n", $db_host );
|
||||
$dbData .= sprintf( "\$dbRbacName = '%s';\n", $rb );
|
||||
$dbData .= sprintf( "\$dbRbacName = '%s';\n", $rb_workpace );
|
||||
$dbData .= sprintf( "\$dbRbacUser = '%s';\n", $rb );
|
||||
$dbData .= sprintf( "\$dbRbacPass = '%s';\n", $rbPass );
|
||||
$dbData .= sprintf( "\$dbReportHost = '%s';\n", $db_host );
|
||||
$dbData .= sprintf( "\$dbReportName = '%s';\n", $rp );
|
||||
$dbData .= sprintf( "\$dbReportName = '%s';\n", $rp_workpace );
|
||||
$dbData .= sprintf( "\$dbReportUser = '%s';\n", $rp );
|
||||
$dbData .= sprintf( "\$dbReportPass = '%s';\n", $rpPass );
|
||||
$databasesText = str_replace( '{dbData}', $dbData, @file_get_contents( PATH_HOME . 'engine/templates/installer/databases.tpl' ) );
|
||||
@@ -731,13 +756,13 @@ class Installer extends Controller
|
||||
file_put_contents( $databases_file, $databasesText );
|
||||
|
||||
// Execute scripts to create and populates databases
|
||||
$query = sprintf( "USE %s;", $rb );
|
||||
$query = sprintf( "USE %s;", $rb_workpace );
|
||||
$this->mysqlQuery( $query );
|
||||
|
||||
$this->mysqlFileQuery( PATH_RBAC_HOME . 'engine/data/mysql/schema.sql' );
|
||||
$this->mysqlFileQuery( PATH_RBAC_HOME . 'engine/data/mysql/insert.sql' );
|
||||
|
||||
$query = sprintf( "USE %s;", $wf );
|
||||
$query = sprintf( "USE %s;", $wf_workpace );
|
||||
$this->mysqlQuery( $query );
|
||||
$this->mysqlFileQuery( PATH_HOME . 'engine/data/mysql/schema.sql' );
|
||||
$this->mysqlFileQuery( PATH_HOME . 'engine/data/mysql/insert.sql' );
|
||||
@@ -768,13 +793,13 @@ class Installer extends Controller
|
||||
}
|
||||
|
||||
// Change admin user
|
||||
$query = sprintf( "USE %s;", $wf );
|
||||
$query = sprintf( "USE %s;", $wf_workpace );
|
||||
$this->mysqlQuery( $query );
|
||||
|
||||
$query = sprintf( "UPDATE USERS SET USR_USERNAME = '%s', USR_PASSWORD = '%s' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, md5( $adminPassword ) );
|
||||
$this->mysqlQuery( $query );
|
||||
|
||||
$query = sprintf( "USE %s;", $rb );
|
||||
$query = sprintf( "USE %s;", $rb_workpace );
|
||||
$this->mysqlQuery( $query );
|
||||
|
||||
$query = sprintf( "UPDATE USERS SET USR_USERNAME = '%s', USR_PASSWORD = '%s' WHERE USR_UID = '00000000000000000000000000000001' ", $adminUsername, md5( $adminPassword ) );
|
||||
@@ -1188,7 +1213,7 @@ class Installer extends Controller
|
||||
$info->message .= G::LoadTranslation('ID_MYSQL_CREDENTIALS_WRONG');
|
||||
return $info;
|
||||
}
|
||||
$res = @mysql_query( "SELECT * FROM `information_schema`.`USER_PRIVILEGES` where (GRANTEE = \"'$db_username'@'$db_hostname'\" OR GRANTEE = \"'$db_username'@'%'\") and PRIVILEGE_TYPE = 'SUPER' ", $link );
|
||||
$res = @mysql_query( "SELECT * FROM `information_schema`.`USER_PRIVILEGES` where (GRANTEE = \"'$db_username'@'$db_hostname'\" OR GRANTEE = \"'$db_username'@'%'\") ", $link );
|
||||
$row = @mysql_fetch_array( $res );
|
||||
$hasSuper = is_array( $row );
|
||||
@mysql_free_result( $res );
|
||||
|
||||
@@ -137,11 +137,11 @@ Ext.onReady(function(){
|
||||
// test database Connection
|
||||
function testConnection() {
|
||||
wizard.showLoadMask(true);
|
||||
if ((Ext.getCmp('db_engine').getValue() == '') || !Ext.getCmp('db_hostname').isValid() || !Ext.getCmp('db_username').isValid()) {
|
||||
if ((Ext.getCmp('db_engine').getValue() == '') || !Ext.getCmp('db_hostname').isValid() || !Ext.getCmp('db_username').isValid()) {
|
||||
wizard.onClientValidation(3, false);
|
||||
wizard.showLoadMask(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Ext.Ajax.request({
|
||||
url: 'testConnection',
|
||||
success: function(response){
|
||||
@@ -156,11 +156,11 @@ Ext.onReady(function(){
|
||||
},
|
||||
failure: function(){},
|
||||
params: {
|
||||
'db_engine' : Ext.getCmp('db_engine').getValue(),
|
||||
'db_hostname': Ext.getCmp('db_hostname').getValue(),
|
||||
'db_username': Ext.getCmp('db_username').getValue(),
|
||||
'db_password': Ext.getCmp('db_password').getValue(),
|
||||
'db_port' : Ext.getCmp('db_port').getValue()
|
||||
'db_engine' : Ext.getCmp('db_engine').getValue(),
|
||||
'db_hostname': Ext.getCmp('db_hostname').getValue(),
|
||||
'db_username': Ext.getCmp('db_username').getValue(),
|
||||
'db_password': Ext.getCmp('db_password').getValue(),
|
||||
'db_port' : Ext.getCmp('db_port').getValue()
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -231,15 +231,15 @@ Ext.onReady(function(){
|
||||
},
|
||||
failure: function(){},
|
||||
params: {
|
||||
'db_engine' : Ext.getCmp('db_engine').getValue(),
|
||||
'db_hostname': Ext.getCmp('db_hostname').getValue(),
|
||||
'db_username': Ext.getCmp('db_username').getValue(),
|
||||
'db_password': Ext.getCmp('db_password').getValue(),
|
||||
'db_port' : Ext.getCmp('db_port').getValue(),
|
||||
'wfDatabase' : Ext.getCmp('wfDatabase').getValue(),
|
||||
'rbDatabase' : Ext.getCmp('rbDatabase').getValue(),
|
||||
'rpDatabase' : Ext.getCmp('rpDatabase').getValue()
|
||||
}
|
||||
'db_engine' : Ext.getCmp('db_engine').getValue(),
|
||||
'db_hostname': Ext.getCmp('db_hostname').getValue(),
|
||||
'db_username': Ext.getCmp('db_username').getValue(),
|
||||
'db_password': Ext.getCmp('db_password').getValue(),
|
||||
'db_port' : Ext.getCmp('db_port').getValue(),
|
||||
'wfDatabase' : Ext.getCmp('wfDatabase').getValue(),
|
||||
'rbDatabase' : Ext.getCmp('rbDatabase').getValue(),
|
||||
'rpDatabase' : Ext.getCmp('rpDatabase').getValue()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ Ext.onReady(function(){
|
||||
{
|
||||
xtype:'panel',
|
||||
layout:'border',
|
||||
height: 340,
|
||||
height: 380,
|
||||
items:[
|
||||
{
|
||||
region: 'west',
|
||||
@@ -365,7 +365,7 @@ Ext.onReady(function(){
|
||||
{
|
||||
xtype:'panel',
|
||||
layout:'border',
|
||||
height: 300,
|
||||
height: 380,
|
||||
items:[
|
||||
{
|
||||
region: 'north',
|
||||
@@ -482,7 +482,7 @@ Ext.onReady(function(){
|
||||
{
|
||||
xtype:'panel',
|
||||
layout:'border',
|
||||
height: 340,
|
||||
height: 380,
|
||||
items:[
|
||||
{
|
||||
region: 'center',
|
||||
@@ -491,8 +491,8 @@ Ext.onReady(function(){
|
||||
new Ext.form.TextArea({
|
||||
name : 'license',
|
||||
readOnly : true,
|
||||
width : 510,
|
||||
height : 280,
|
||||
width : 600,
|
||||
height : 330,
|
||||
style : 'font-size:13px',
|
||||
value : licenseTxt
|
||||
}),
|
||||
@@ -533,7 +533,7 @@ Ext.onReady(function(){
|
||||
{
|
||||
xtype:'panel',
|
||||
layout:'border',
|
||||
height: 360,
|
||||
height: 380,
|
||||
items:[
|
||||
{
|
||||
region: 'west',
|
||||
@@ -671,7 +671,7 @@ Ext.onReady(function(){
|
||||
{
|
||||
xtype:'panel',
|
||||
layout:'border',
|
||||
height: 360,
|
||||
height: 380,
|
||||
items:[
|
||||
{
|
||||
region: 'west',
|
||||
@@ -835,6 +835,13 @@ Ext.onReady(function(){
|
||||
wizard.onClientValidation(4, false);
|
||||
}
|
||||
}),
|
||||
new Ext.form.Checkbox({
|
||||
boxLabel: _('ID_INSTALL_USE_CURRENT_USER'),
|
||||
id : 'createUserLogged',
|
||||
handler: function() {
|
||||
wizard.onClientValidation(4, false);
|
||||
}
|
||||
}),
|
||||
{
|
||||
xtype : 'displayfield',
|
||||
id : 'finish_message'
|
||||
|
||||
@@ -10,7 +10,7 @@ Ext.onReady(function(){
|
||||
Ext.QuickTips.init();
|
||||
|
||||
wizard = new Ext.ux.Wiz({
|
||||
height: 520,
|
||||
height: 555,
|
||||
width : 780,
|
||||
id : 'wizard',
|
||||
closable: false,
|
||||
@@ -87,23 +87,24 @@ function finishInstallation()
|
||||
},
|
||||
failure: function(){Ext.MessageBox.hide(); wizard.showLoadMask(false);},
|
||||
params: {
|
||||
'db_engine' : Ext.getCmp('db_engine' ).getValue(),
|
||||
'db_hostname' : Ext.getCmp('db_hostname' ).getValue(),
|
||||
'db_username' : Ext.getCmp('db_username' ).getValue(),
|
||||
'db_password' : Ext.getCmp('db_password' ).getValue(),
|
||||
'db_port' : Ext.getCmp('db_port' ).getValue(),
|
||||
'pathConfig' : Ext.getCmp('pathConfig' ).getValue(),
|
||||
'pathLanguages' : Ext.getCmp('pathLanguages').getValue(),
|
||||
'pathPlugins' : Ext.getCmp('pathPlugins' ).getValue(),
|
||||
'pathXmlforms' : Ext.getCmp('pathXmlforms' ).getValue(),
|
||||
'pathShared' : Ext.getCmp('pathShared' ).getValue(),
|
||||
'workspace' : Ext.getCmp('workspace' ).getValue(),
|
||||
'adminUsername' : Ext.getCmp('adminUsername').getValue(),
|
||||
'adminPassword' : Ext.getCmp('adminPassword').getValue(),
|
||||
'wfDatabase' : Ext.getCmp('wfDatabase' ).getValue(),
|
||||
'rbDatabase' : Ext.getCmp('rbDatabase' ).getValue(),
|
||||
'rpDatabase' : Ext.getCmp('rpDatabase' ).getValue(),
|
||||
'deleteDB' : Ext.getCmp('deleteDB' ).getValue()
|
||||
'db_engine' : Ext.getCmp('db_engine' ).getValue(),
|
||||
'db_hostname' : Ext.getCmp('db_hostname' ).getValue(),
|
||||
'db_username' : Ext.getCmp('db_username' ).getValue(),
|
||||
'db_password' : Ext.getCmp('db_password' ).getValue(),
|
||||
'db_port' : Ext.getCmp('db_port' ).getValue(),
|
||||
'pathConfig' : Ext.getCmp('pathConfig' ).getValue(),
|
||||
'pathLanguages' : Ext.getCmp('pathLanguages' ).getValue(),
|
||||
'pathPlugins' : Ext.getCmp('pathPlugins' ).getValue(),
|
||||
'pathXmlforms' : Ext.getCmp('pathXmlforms' ).getValue(),
|
||||
'pathShared' : Ext.getCmp('pathShared' ).getValue(),
|
||||
'workspace' : Ext.getCmp('workspace' ).getValue(),
|
||||
'adminUsername' : Ext.getCmp('adminUsername' ).getValue(),
|
||||
'adminPassword' : Ext.getCmp('adminPassword' ).getValue(),
|
||||
'wfDatabase' : Ext.getCmp('wfDatabase' ).getValue(),
|
||||
'rbDatabase' : Ext.getCmp('rbDatabase' ).getValue(),
|
||||
'rpDatabase' : Ext.getCmp('rpDatabase' ).getValue(),
|
||||
'deleteDB' : Ext.getCmp('deleteDB' ).getValue(),
|
||||
'userLogged' : Ext.getCmp('createUserLogged' ).getValue()
|
||||
},
|
||||
timeout: 180000
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user