Merge pull request #897 from brayanpereyra/BUG-9717

BUG 9717 I removed lines code SOLVED
This commit is contained in:
julceslauhub
2012-11-06 10:33:26 -08:00
5 changed files with 60 additions and 23 deletions

View File

@@ -218,7 +218,6 @@ class RBAC
{
$result = - 1; //default return value,
foreach ($this->aRbacPlugins as $sClassName) {
$plugin = new $sClassName();
if (method_exists( $plugin, 'automaticRegister' )) {
@@ -277,14 +276,14 @@ class RBAC
return - 4; //due date
}
foreach ($this->aRbacPlugins as $sClassName) {
if (strtolower( $sClassName ) == strtolower( $sAuthType )) {
$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 +334,9 @@ class RBAC
if (isset( $this->userObj->fields['USR_AUTH_TYPE'] )) {
$sAuthType = strtolower( $this->userObj->fields['USR_AUTH_TYPE'] );
}
//Hook for RBAC plugins
if ($sAuthType != "mysql" && $sAuthType != "") {
$res = $this->VerifyWithOtherAuthenticationSource( $sAuthType, $this->userObj->fields, $strPass );
return $res;
} else {

View File

@@ -46,7 +46,6 @@ try {
}
$aFields = $RBAC->getAuthSource( $_POST['sUID'] );
G::LoadThirdParty( 'pear/json', 'class.json' );
$oJSON = new Services_JSON();
$i = 0;
@@ -130,8 +129,6 @@ try {
echo '{sources: ' . G::json_encode( $aSources ) . ', total_sources: ' . $total_sources . '}';
break;
case 'canDeleteAuthSource':
//echo 'llego';
//require_once PATH_RBAC.'model/RbacUsers.php';
try {
$authUID = $_POST['auth_uid'];
global $RBAC;

View File

@@ -53,8 +53,20 @@ 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'] );
$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'] )) {
@@ -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_PASSWORD', 'USR_EMAIL', 'USR_CREATE_DATE', 'USR_UPDATE_DATE', 'USR_STATUS', 'USR_COUNTRY', 'USR_CITY', 'USR_LOCATION', 'DEP_UID', 'USR_RESUME', 'USR_ROLE', 'USR_REPORTS_TO', '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' )

View File

@@ -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();
@@ -64,6 +67,14 @@ foreach ($_POST['aUsers'] as $sUser) {
$aData['USR_UID'] = $sUserUID;
$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 );

View File

@@ -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'] == '') {