diff --git a/gulliver/system/class.rbac.php b/gulliver/system/class.rbac.php
index d8e080e83..606fe5a48 100755
--- a/gulliver/system/class.rbac.php
+++ b/gulliver/system/class.rbac.php
@@ -218,7 +218,6 @@ class RBAC
{
$result = - 1; //default return value,
-
foreach ($this->aRbacPlugins as $sClassName) {
$plugin = new $sClassName();
if (method_exists( $plugin, 'automaticRegister' )) {
@@ -283,8 +282,9 @@ class RBAC
$plugin = new $sClassName();
$plugin->sAuthSource = $aUserFields["UID_AUTH_SOURCE"];
$plugin->sSystem = $this->sSystem;
- $bValidUser = $plugin->VerifyLogin( $aUserFields["USR_AUTH_USER_DN"], $strPass );
+ $bValidUser = false;
+ $bValidUser = $plugin->VerifyLogin( $aUserFields["USR_AUTH_USER_DN"], $strPass );
if ($bValidUser === true) {
return ($aUserFields['USR_UID']);
} else {
@@ -335,9 +335,9 @@ class RBAC
if (isset( $this->userObj->fields['USR_AUTH_TYPE'] )) {
$sAuthType = strtolower( $this->userObj->fields['USR_AUTH_TYPE'] );
}
-
- //Hook for RBAC plugins
+ //Hook for RBAC plugins
if ($sAuthType != "mysql" && $sAuthType != "") {
+
$res = $this->VerifyWithOtherAuthenticationSource( $sAuthType, $this->userObj->fields, $strPass );
return $res;
} else {
diff --git a/workflow/engine/methods/authSources/authSources_Ajax.php b/workflow/engine/methods/authSources/authSources_Ajax.php
index f520b428d..9e964a3e1 100755
--- a/workflow/engine/methods/authSources/authSources_Ajax.php
+++ b/workflow/engine/methods/authSources/authSources_Ajax.php
@@ -45,28 +45,27 @@ try {
$dataset->next();
}
- $aFields = $RBAC->getAuthSource( $_POST['sUID'] );
-
+ $aFields = $RBAC->getAuthSource( $_POST['sUID'] );
G::LoadThirdParty( 'pear/json', 'class.json' );
$oJSON = new Services_JSON();
$i = 0;
$oUser = new Users();
$aAux = $RBAC->searchUsers( $_POST['sUID'], $_POST['sKeyword'] );
$aUsers = array ();
- // note added by gustavo cruz gustavo-at-colosa.com
- // changed the user data showed to accept FirstName and LastName variables
+ // note added by gustavo cruz gustavo-at-colosa.com
+ // changed the user data showed to accept FirstName and LastName variables
$aUsers[] = array ('Checkbox' => 'char','Username' => 'char','FullName' => 'char','FirstName' => 'char','LastName' => 'char','Email' => 'char','DistinguishedName' => 'char'
);
foreach ($aAux as $aUser) {
if (! in_array( $aUser['sUsername'], $pmUsers )) {
- // add replace to change D'Souza to D*Souza by krlos
+ // add replace to change D'Souza to D*Souza by krlos
$sCheckbox = '
encode( $aUser ) ) ) . '\' />
';
$i ++;
} else {
$sCheckbox = G::LoadTranslation( 'ID_USER_REGISTERED' ) . ':
(' . $aUser['sUsername'] . ')';
}
- // note added by gustavo cruz gustavo-at-colosa.com
- // assign the user data to the DBArray variable.
+ // note added by gustavo cruz gustavo-at-colosa.com
+ // assign the user data to the DBArray variable.
$aUsers[] = array ('Checkbox' => $sCheckbox,'Username' => $aUser['sUsername'],'FullName' => $aUser['sFullname'],'FirstName' => $aUser['sFirstname'],'LastName' => $aUser['sLastname'],'Email' => $aUser['sEmail'],'DistinguishedName' => $aUser['sDN']
);
}
@@ -130,8 +129,8 @@ try {
echo '{sources: ' . G::json_encode( $aSources ) . ', total_sources: ' . $total_sources . '}';
break;
case 'canDeleteAuthSource':
- //echo 'llego';
- //require_once PATH_RBAC.'model/RbacUsers.php';
+ //echo 'llego';
+ //require_once PATH_RBAC.'model/RbacUsers.php';
try {
$authUID = $_POST['auth_uid'];
global $RBAC;
diff --git a/workflow/engine/methods/authSources/authSources_Edit.php b/workflow/engine/methods/authSources/authSources_Edit.php
index 33747a0c7..576e9c88c 100755
--- a/workflow/engine/methods/authSources/authSources_Edit.php
+++ b/workflow/engine/methods/authSources/authSources_Edit.php
@@ -53,10 +53,22 @@ if (is_array( $fields['AUTH_SOURCE_DATA'] )) {
$fields[$field] = $value;
}
}
+$fields['AUTH_SOURCE_SHOWGRID_FLAG'] = 0;
+if (isset($fields['AUTH_SOURCE_DATA']['AUTH_SOURCE_SHOWGRID']) && $fields['AUTH_SOURCE_DATA']['AUTH_SOURCE_SHOWGRID'] == 'on') {
+ $fields['AUTH_SOURCE_SHOWGRID_FLAG'] = 1;
+}
unset( $fields['AUTH_SOURCE_DATA'] );
-//fixing a problem with dropdown with int values,
-//the problem : the value was integer, but the dropdown was expecting a string value, and they returns always the first item of dropdown
+$textAttribute = '';
+if (isset($fields['AUTH_SOURCE_GRID_ATTRIBUTE']) && count($fields['AUTH_SOURCE_GRID_ATTRIBUTE'])) {
+ foreach ($fields['AUTH_SOURCE_GRID_ATTRIBUTE'] as $value) {
+ $textAttribute .= '|' . $value['attributeLdap'] . '/' . $value['attributeUser'];
+ }
+}
+$fields['AUTH_SOURCE_GRID_TEXT'] = $textAttribute;
+
+//fixing a problem with dropdown with int values,
+//the problem : the value was integer, but the dropdown was expecting a string value, and they returns always the first item of dropdown
if (isset( $fields['AUTH_SOURCE_ENABLED_TLS'] )) {
$fields['AUTH_SOURCE_ENABLED_TLS'] = sprintf( '%d', $fields['AUTH_SOURCE_ENABLED_TLS'] );
}
@@ -73,6 +85,17 @@ if ($fields['AUTH_SOURCE_PROVIDER'] == 'ldap') {
} else {
if (file_exists( PATH_PLUGINS . $fields['AUTH_SOURCE_PROVIDER'] . PATH_SEP . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' )) {
if (class_exists( $fields['AUTH_SOURCE_PROVIDER'] )) {
+ // The attributes the users
+ G::loadClass('pmFunctions');
+ $data = executeQuery('DESCRIBE USERS');
+ $fieldSet = array('USR_UID','USR_USERNAME','USR_ROLE','USR_REPLACED_BY','USR_UX');
+ $attributes = '';
+ foreach ($data as $value) {
+ if (!(in_array($value['Field'], $fieldSet))) {
+ $attributes .= $value['Field'] . '|';
+ }
+ }
+ $fields['AUTH_SOURCE_ATTRIBUTE_IDS'] = $attributes;
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', $fields['AUTH_SOURCE_PROVIDER'] . PATH_SEP . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml', '', $fields, '../authSources/authSources_Save' );
} else {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', array ('MESSAGE' => G::LoadTranslation( 'ID_AUTH_SOURCE_MISSING' )
diff --git a/workflow/engine/methods/authSources/authSources_ImportUsers.php b/workflow/engine/methods/authSources/authSources_ImportUsers.php
index 79ba7719d..18c51c953 100755
--- a/workflow/engine/methods/authSources/authSources_ImportUsers.php
+++ b/workflow/engine/methods/authSources/authSources_ImportUsers.php
@@ -27,8 +27,11 @@ if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) {
G::header( 'location: ../login/login' );
die();
}
-
$aFields = $RBAC->getAuthSource( $_POST['form']['AUTH_SOURCE_UID'] );
+$aAttributes = array();
+if (isset($aFields['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'])) {
+ $aAttributes = $aFields['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'];
+}
G::LoadThirdParty( 'pear/json', 'class.json' );
$oJSON = new Services_JSON();
@@ -38,9 +41,9 @@ foreach ($_POST['aUsers'] as $sUser) {
$aUser = (array) $oJSON->decode( stripslashes( $sUser ) );
$aData['USR_USERNAME'] = str_replace( "*", "'", $aUser['sUsername'] );
$aData['USR_PASSWORD'] = md5( str_replace( "*", "'", $aUser['sUsername'] ) );
- // note added by gustavo gustavo-at-colosa.com
- // asign the FirstName and LastName variables
- // add replace to change D*Souza to D'Souza by krlos
+ // note added by gustavo gustavo-at-colosa.com
+ // asign the FirstName and LastName variables
+ // add replace to change D*Souza to D'Souza by krlos
$aData['USR_FIRSTNAME'] = str_replace( "*", "'", $aUser['sFirstname'] );
$aData['USR_LASTNAME'] = str_replace( "*", "'", $aUser['sLastname'] );
$aData['USR_EMAIL'] = $aUser['sEmail'];
@@ -51,8 +54,8 @@ foreach ($_POST['aUsers'] as $sUser) {
$aData['USR_STATUS'] = 1;
$aData['USR_AUTH_TYPE'] = strtolower( $aFields['AUTH_SOURCE_PROVIDER'] );
$aData['UID_AUTH_SOURCE'] = $aFields['AUTH_SOURCE_UID'];
- // validating with regexp if there are some missing * inside the DN string
- // if it's so the is changed to the ' character
+ // validating with regexp if there are some missing * inside the DN string
+ // if it's so the is changed to the ' character
preg_match( '/[a-zA-Z]\*[a-zA-Z]/', $aUser['sDN'], $matches );
foreach ($matches as $key => $match) {
$newMatch = str_replace( '*', '\'', $match );
@@ -62,8 +65,16 @@ foreach ($_POST['aUsers'] as $sUser) {
$sUserUID = $RBAC->createUser( $aData, 'PROCESSMAKER_OPERATOR' );
$aData['USR_STATUS'] = 'ACTIVE';
$aData['USR_UID'] = $sUserUID;
- $aData['USR_PASSWORD'] = md5( $sUserUID ); //fake :p
+ $aData['USR_PASSWORD'] = md5( $sUserUID ); //fake :p
$aData['USR_ROLE'] = 'PROCESSMAKER_OPERATOR';
+
+ if (count($aAttributes)) {
+ foreach ($aAttributes as $value) {
+ if (isset($aUser[$value['attributeUser']])) {
+ $aData[$value['attributeUser']] = str_replace( "*", "'", $aUser[$value['attributeUser']] );
+ }
+ }
+ }
require_once 'classes/model/Users.php';
$oUser = new Users();
$oUser->create( $aData );
diff --git a/workflow/engine/methods/authSources/authSources_Save.php b/workflow/engine/methods/authSources/authSources_Save.php
index 2169abcd2..0de9a8cfc 100755
--- a/workflow/engine/methods/authSources/authSources_Save.php
+++ b/workflow/engine/methods/authSources/authSources_Save.php
@@ -41,6 +41,13 @@ foreach ($_POST['form'] as $sField => $sValue) {
$aData[$sField] = $sValue;
}
}
+unset($aData['AUTH_SOURCE_ATTRIBUTE_IDS']);
+unset($aData['AUTH_SOURCE_SHOWGRID_FLAG']);
+unset($aData['AUTH_SOURCE_GRID_TEXT']);
+if (!isset($aData['AUTH_SOURCE_SHOWGRID']) || $aData['AUTH_SOURCE_SHOWGRID'] == 'off') {
+ unset($aData['AUTH_SOURCE_GRID_ATTRIBUTE']);
+}
+
$aFields['AUTH_SOURCE_DATA'] = $aData;
if ($aFields['AUTH_SOURCE_UID'] == '') {