From a35ff937df87582d286fdb356c254fc54775440d Mon Sep 17 00:00:00 2001 From: norahmollo Date: Wed, 17 Oct 2012 20:00:22 +0000 Subject: [PATCH 1/6] CODE STYLE Formating workflow/engine/methods/authSources/authSources_Delete.php Change format files in workflow/engine/methods/authSources/authSources_Delete.php --- .../authSources/authSources_Delete.php | 63 +++++++++---------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/workflow/engine/methods/authSources/authSources_Delete.php b/workflow/engine/methods/authSources/authSources_Delete.php index 05c580c24..08b439be2 100755 --- a/workflow/engine/methods/authSources/authSources_Delete.php +++ b/workflow/engine/methods/authSources/authSources_Delete.php @@ -1,32 +1,31 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; -} - -$RBAC->removeAuthSource($_POST['AUTH_SOURCE_UID']); \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); +} + +$RBAC->removeAuthSource( $_POST['AUTH_SOURCE_UID'] ); \ No newline at end of file From dabed41d87024aa3b1021a9cb1b108f65c3caeb2 Mon Sep 17 00:00:00 2001 From: norahmollo Date: Wed, 17 Oct 2012 20:02:29 +0000 Subject: [PATCH 2/6] CODE STYLE Formating workflow/engine/methods/authSources/authSources_Delete.php Change format files in workflow/engine/methods/authSources/authSources_Delete.php --- workflow/engine/methods/authSources/authSources_Delete.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workflow/engine/methods/authSources/authSources_Delete.php b/workflow/engine/methods/authSources/authSources_Delete.php index 08b439be2..900f3163b 100755 --- a/workflow/engine/methods/authSources/authSources_Delete.php +++ b/workflow/engine/methods/authSources/authSources_Delete.php @@ -28,4 +28,5 @@ if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { die(); } -$RBAC->removeAuthSource( $_POST['AUTH_SOURCE_UID'] ); \ No newline at end of file +$RBAC->removeAuthSource( $_POST['AUTH_SOURCE_UID'] ); + From a3ff01806f96790e97432af84e95337c3ec46174 Mon Sep 17 00:00:00 2001 From: norahmollo Date: Wed, 17 Oct 2012 20:05:15 +0000 Subject: [PATCH 3/6] CODE STYLE Formating workflow/engine/methods/authSources/authSources_Ajax.php Change format files in workflow/engine/methods/authSources/authSources_Ajax.php --- .../methods/authSources/authSources_Ajax.php | 397 +++++++++--------- 1 file changed, 193 insertions(+), 204 deletions(-) diff --git a/workflow/engine/methods/authSources/authSources_Ajax.php b/workflow/engine/methods/authSources/authSources_Ajax.php index 807b02cd5..f520b428d 100755 --- a/workflow/engine/methods/authSources/authSources_Ajax.php +++ b/workflow/engine/methods/authSources/authSources_Ajax.php @@ -1,204 +1,193 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -try { - global $RBAC; - if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; - } - - switch ($_REQUEST['action']) { - case 'searchUsers': - require_once 'classes/model/Users.php'; - $criteria = new Criteria('workflow'); - $criteria->addSelectColumn(UsersPeer::USR_USERNAME); - $criteria->add(UsersPeer::USR_STATUS, array('CLOSED'), Criteria::NOT_IN); - $dataset = UsersPeer::DoSelectRs($criteria); - $dataset->setFetchmode (ResultSet::FETCHMODE_ASSOC); - $dataset->next(); - $pmUsers = array(); - while ($row = $dataset->getRow()) { - $pmUsers[] = $row['USR_USERNAME']; - $dataset->next(); - } - - $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 - $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 - $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. - $aUsers[] = array('Checkbox' => $sCheckbox, - 'Username' => $aUser['sUsername'], - 'FullName' => $aUser['sFullname'], - 'FirstName' => $aUser['sFirstname'], - 'LastName' => $aUser['sLastname'], - 'Email' => $aUser['sEmail'], - 'DistinguishedName' => $aUser['sDN']); - } - global $_DBArray; - $_DBArray['users'] = $aUsers; - $_SESSION['_DBArray'] = $_DBArray; - G::LoadClass('ArrayPeer'); - $oCriteria = new Criteria('dbarray'); - $oCriteria->setDBArrayTable('users'); - $aData = Array( - 'Checkbox'=>'0', - 'FullName'=>'0' - ); - - global $G_PUBLISH; - $G_PUBLISH = new Publisher(); - if ($aFields['AUTH_SOURCE_PROVIDER'] != 'ldap') { - $G_PUBLISH->AddContent('propeltable', 'pagedTableLdap', 'authSources/ldapSearchResults', $oCriteria,' ',array('Checkbox' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER'))); - } - else { - if (file_exists(PATH_XMLFORM . 'authSources/' . $aFields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) { - $G_PUBLISH->AddContent('propeltable', 'pagedTableLdap', 'authSources/' . $aFields['AUTH_SOURCE_PROVIDER'] . 'SearchResults', $oCriteria,' ',array('Checkbox' => G::LoadTranslation('ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER'))); - } - else { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => 'File: ' . $aFields['AUTH_SOURCE_PROVIDER'] . 'SearchResults.xml' . ' doesn\'t exist.')); - } - } - G::RenderPage('publish', 'raw'); - break; - case 'authSourcesList': - require_once PATH_RBAC.'model/AuthenticationSource.php'; - global $RBAC; - G::LoadClass('configuration'); - $co = new Configurations(); - $config = $co->getConfiguration('authSourcesList', 'pageSize','',$_SESSION['USER_LOGGED']); - $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20; - - $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0; - $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size; - $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : ''; - - $Criterias = $RBAC->getAuthenticationSources($start, $limit, $filter); - - $Dat = AuthenticationSourcePeer::doSelectRS($Criterias['COUNTER']); - $Dat->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $Dat->next(); - $row = $Dat->getRow(); - $total_sources = $row['CNT']; - - $oDataset = AuthenticationSourcePeer::doSelectRS($Criterias['LIST']); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - global $RBAC; - $auth = $RBAC->getAllUsersByAuthSource(); - - $aSources = Array(); - while ($oDataset->next()){ - $aSources[] = $oDataset->getRow(); - $index = sizeof($aSources)-1; - $aSources[$index]['CURRENT_USERS'] = isset($auth[$aSources[$index]['AUTH_SOURCE_UID']]) ? $auth[$aSources[$index]['AUTH_SOURCE_UID']] : 0; - } - 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; - $aAuth = $RBAC->getAllUsersByAuthSource(); - $response = isset($aAuth[$authUID]) ? 'false' : 'true'; - echo '{success: '.$response.'}'; - }catch(Exception $ex){ - echo '{success: false, error: '.$ex->getMessage().'}'; - } - break; - case 'deleteAuthSource': - try{ - global $RBAC; - $RBAC->removeAuthSource($_POST['auth_uid']); - echo '{success: true}'; - }catch(Exception $ex){ - echo '{success: false, error: '.$ex->getMessage().'}'; - } - break; - case 'authSourcesNew': - $arr = Array(); - $oDirectory = dir(PATH_RBAC . 'plugins' . PATH_SEP); - $aAuthSourceTypes = array(); - while($sObject = $oDirectory->read()) { - if (($sObject != '.') && ($sObject != '..') && ($sObject != '.svn') && ($sObject != 'ldap')) { - if (is_file(PATH_RBAC . 'plugins' . PATH_SEP . $sObject)) { - $sType = trim(str_replace('class.', '', str_replace('.php', '', $sObject))); - $aAuthSourceTypes['sType'] = $sType; - $aAuthSourceTypes['sLabel'] = $sType; - $arr[] = $aAuthSourceTypes; - } - } - } - echo '{sources: '.G::json_encode($arr).'}'; - break; - case 'loadauthSourceData': - global $RBAC; - - $fields = $RBAC->getAuthSource($_POST['sUID']); - if (is_array($fields['AUTH_SOURCE_DATA'])) { - foreach($fields['AUTH_SOURCE_DATA'] as $field => $value) { - $fields[$field] = $value; - } - } - unset($fields['AUTH_SOURCE_DATA']); - $result->success = true; - $result->sources = $fields; - print(G::json_encode($result)); - break; - } -} -catch ( Exception $e ) { - $fields = array('MESSAGE' => $e->getMessage() ); - global $G_PUBLISH; - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $fields ); - G::RenderPage('publish', 'blank'); -} +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +try { + global $RBAC; + if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); + } + + switch ($_REQUEST['action']) { + case 'searchUsers': + require_once 'classes/model/Users.php'; + $criteria = new Criteria( 'workflow' ); + $criteria->addSelectColumn( UsersPeer::USR_USERNAME ); + $criteria->add( UsersPeer::USR_STATUS, array ('CLOSED' + ), Criteria::NOT_IN ); + $dataset = UsersPeer::DoSelectRs( $criteria ); + $dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $dataset->next(); + $pmUsers = array (); + while ($row = $dataset->getRow()) { + $pmUsers[] = $row['USR_USERNAME']; + $dataset->next(); + } + + $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 + $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 + $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. + $aUsers[] = array ('Checkbox' => $sCheckbox,'Username' => $aUser['sUsername'],'FullName' => $aUser['sFullname'],'FirstName' => $aUser['sFirstname'],'LastName' => $aUser['sLastname'],'Email' => $aUser['sEmail'],'DistinguishedName' => $aUser['sDN'] + ); + } + global $_DBArray; + $_DBArray['users'] = $aUsers; + $_SESSION['_DBArray'] = $_DBArray; + G::LoadClass( 'ArrayPeer' ); + $oCriteria = new Criteria( 'dbarray' ); + $oCriteria->setDBArrayTable( 'users' ); + $aData = Array ('Checkbox' => '0','FullName' => '0' + ); + + global $G_PUBLISH; + $G_PUBLISH = new Publisher(); + if ($aFields['AUTH_SOURCE_PROVIDER'] != 'ldap') { + $G_PUBLISH->AddContent( 'propeltable', 'pagedTableLdap', 'authSources/ldapSearchResults', $oCriteria, ' ', array ('Checkbox' => G::LoadTranslation( 'ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER' ) + ) ); + } else { + if (file_exists( PATH_XMLFORM . 'authSources/' . $aFields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' )) { + $G_PUBLISH->AddContent( 'propeltable', 'pagedTableLdap', 'authSources/' . $aFields['AUTH_SOURCE_PROVIDER'] . 'SearchResults', $oCriteria, ' ', array ('Checkbox' => G::LoadTranslation( 'ID_MSG_CONFIRM_DELETE_CASE_SCHEDULER' ) + ) ); + } else { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', array ('MESSAGE' => 'File: ' . $aFields['AUTH_SOURCE_PROVIDER'] . 'SearchResults.xml' . ' doesn\'t exist.' + ) ); + } + } + G::RenderPage( 'publish', 'raw' ); + break; + case 'authSourcesList': + require_once PATH_RBAC . 'model/AuthenticationSource.php'; + global $RBAC; + G::LoadClass( 'configuration' ); + $co = new Configurations(); + $config = $co->getConfiguration( 'authSourcesList', 'pageSize', '', $_SESSION['USER_LOGGED'] ); + $limit_size = isset( $config['pageSize'] ) ? $config['pageSize'] : 20; + + $start = isset( $_REQUEST['start'] ) ? $_REQUEST['start'] : 0; + $limit = isset( $_REQUEST['limit'] ) ? $_REQUEST['limit'] : $limit_size; + $filter = isset( $_REQUEST['textFilter'] ) ? $_REQUEST['textFilter'] : ''; + + $Criterias = $RBAC->getAuthenticationSources( $start, $limit, $filter ); + + $Dat = AuthenticationSourcePeer::doSelectRS( $Criterias['COUNTER'] ); + $Dat->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $Dat->next(); + $row = $Dat->getRow(); + $total_sources = $row['CNT']; + + $oDataset = AuthenticationSourcePeer::doSelectRS( $Criterias['LIST'] ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + + global $RBAC; + $auth = $RBAC->getAllUsersByAuthSource(); + + $aSources = Array (); + while ($oDataset->next()) { + $aSources[] = $oDataset->getRow(); + $index = sizeof( $aSources ) - 1; + $aSources[$index]['CURRENT_USERS'] = isset( $auth[$aSources[$index]['AUTH_SOURCE_UID']] ) ? $auth[$aSources[$index]['AUTH_SOURCE_UID']] : 0; + } + 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; + $aAuth = $RBAC->getAllUsersByAuthSource(); + $response = isset( $aAuth[$authUID] ) ? 'false' : 'true'; + echo '{success: ' . $response . '}'; + } catch (Exception $ex) { + echo '{success: false, error: ' . $ex->getMessage() . '}'; + } + break; + case 'deleteAuthSource': + try { + global $RBAC; + $RBAC->removeAuthSource( $_POST['auth_uid'] ); + echo '{success: true}'; + } catch (Exception $ex) { + echo '{success: false, error: ' . $ex->getMessage() . '}'; + } + break; + case 'authSourcesNew': + $arr = Array (); + $oDirectory = dir( PATH_RBAC . 'plugins' . PATH_SEP ); + $aAuthSourceTypes = array (); + while ($sObject = $oDirectory->read()) { + if (($sObject != '.') && ($sObject != '..') && ($sObject != '.svn') && ($sObject != 'ldap')) { + if (is_file( PATH_RBAC . 'plugins' . PATH_SEP . $sObject )) { + $sType = trim( str_replace( 'class.', '', str_replace( '.php', '', $sObject ) ) ); + $aAuthSourceTypes['sType'] = $sType; + $aAuthSourceTypes['sLabel'] = $sType; + $arr[] = $aAuthSourceTypes; + } + } + } + echo '{sources: ' . G::json_encode( $arr ) . '}'; + break; + case 'loadauthSourceData': + global $RBAC; + + $fields = $RBAC->getAuthSource( $_POST['sUID'] ); + if (is_array( $fields['AUTH_SOURCE_DATA'] )) { + foreach ($fields['AUTH_SOURCE_DATA'] as $field => $value) { + $fields[$field] = $value; + } + } + unset( $fields['AUTH_SOURCE_DATA'] ); + $result->success = true; + $result->sources = $fields; + print (G::json_encode( $result )) ; + break; + } +} catch (Exception $e) { + $fields = array ('MESSAGE' => $e->getMessage() + ); + global $G_PUBLISH; + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $fields ); + G::RenderPage( 'publish', 'blank' ); +} + From 1b509153a1a6bd388dbf2e9ca60d79dd8fb8f8b8 Mon Sep 17 00:00:00 2001 From: norahmollo Date: Wed, 17 Oct 2012 20:09:34 +0000 Subject: [PATCH 4/6] CODE STYLE Formating workflow/engine/methods/authSources/authSources_Edit.php Change format files in workflow/engine/methods/authSources/authSources_Edit.php --- .../methods/authSources/authSources_Edit.php | 180 +++++++++--------- 1 file changed, 89 insertions(+), 91 deletions(-) diff --git a/workflow/engine/methods/authSources/authSources_Edit.php b/workflow/engine/methods/authSources/authSources_Edit.php index 52f0f5cde..33747a0c7 100755 --- a/workflow/engine/methods/authSources/authSources_Edit.php +++ b/workflow/engine/methods/authSources/authSources_Edit.php @@ -1,93 +1,91 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -global $RBAC; -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; -} - -if (!isset($_GET['sUID'])) { - G::SendTemporalMessage('ID_ERROR_OBJECT_NOT_EXISTS', 'error', 'labels'); - G::header('location: authSources_List'); - die; -} - -if ($_GET['sUID'] == '') { - G::SendTemporalMessage('ID_ERROR_OBJECT_NOT_EXISTS', 'error', 'labels'); - G::header('location: authSources_List'); - die; -} - -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'users'; -$G_ID_MENU_SELECTED = 'USERS'; -$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; - -$fields = $RBAC->getAuthSource($_GET['sUID']); - -if (is_array($fields['AUTH_SOURCE_DATA'])) { - foreach($fields['AUTH_SOURCE_DATA'] as $field => $value) { - $fields[$field] = $value; - } -} -unset($fields['AUTH_SOURCE_DATA']); - +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ + +global $RBAC; +if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); +} + +if (! isset( $_GET['sUID'] )) { + G::SendTemporalMessage( 'ID_ERROR_OBJECT_NOT_EXISTS', 'error', 'labels' ); + G::header( 'location: authSources_List' ); + die(); +} + +if ($_GET['sUID'] == '') { + G::SendTemporalMessage( 'ID_ERROR_OBJECT_NOT_EXISTS', 'error', 'labels' ); + G::header( 'location: authSources_List' ); + die(); +} + +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'users'; +$G_ID_MENU_SELECTED = 'USERS'; +$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; + +$fields = $RBAC->getAuthSource( $_GET['sUID'] ); + +if (is_array( $fields['AUTH_SOURCE_DATA'] )) { + foreach ($fields['AUTH_SOURCE_DATA'] as $field => $value) { + $fields[$field] = $value; + } +} +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 -if (isset($fields['AUTH_SOURCE_ENABLED_TLS'])) { - $fields['AUTH_SOURCE_ENABLED_TLS'] = sprintf('%d', $fields['AUTH_SOURCE_ENABLED_TLS']); -} -if (isset($fields['AUTH_ANONYMOUS'])) { - $fields['AUTH_ANONYMOUS'] = sprintf('%d', $fields['AUTH_ANONYMOUS']); -} - -$G_PUBLISH = new Publisher(); -if ($fields['AUTH_SOURCE_PROVIDER'] == 'ldap' ) { - $oHeadPublisher =& headPublisher::getSingleton(); - $oHeadPublisher->addExtJsScript('authSources/authSourcesEdit', false); - $oHeadPublisher->assign('sUID',$_GET['sUID']); - G::RenderPage('publish', 'extJs'); -} -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'])) { - $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'))); - } - } - else { - if (file_exists(PATH_XMLFORM . 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml')) { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit', '', $fields, '../authSources/authSources_Save'); - } - else { - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => 'File: ' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' . ' not exists.')); - } - } - G::RenderPage('publish', 'blank'); -} \ No newline at end of file +if (isset( $fields['AUTH_SOURCE_ENABLED_TLS'] )) { + $fields['AUTH_SOURCE_ENABLED_TLS'] = sprintf( '%d', $fields['AUTH_SOURCE_ENABLED_TLS'] ); +} +if (isset( $fields['AUTH_ANONYMOUS'] )) { + $fields['AUTH_ANONYMOUS'] = sprintf( '%d', $fields['AUTH_ANONYMOUS'] ); +} + +$G_PUBLISH = new Publisher(); +if ($fields['AUTH_SOURCE_PROVIDER'] == 'ldap') { + $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher->addExtJsScript( 'authSources/authSourcesEdit', false ); + $oHeadPublisher->assign( 'sUID', $_GET['sUID'] ); + G::RenderPage( 'publish', 'extJs' ); +} 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'] )) { + $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' ) + ) ); + } + } else { + if (file_exists( PATH_XMLFORM . 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' )) { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'authSources/' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit', '', $fields, '../authSources/authSources_Save' ); + } else { + $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', array ('MESSAGE' => 'File: ' . $fields['AUTH_SOURCE_PROVIDER'] . 'Edit.xml' . ' not exists.' + ) ); + } + } + G::RenderPage( 'publish', 'blank' ); +} + From 7e753292c01c8c5aa5afd4a57b04161a674b5e43 Mon Sep 17 00:00:00 2001 From: norahmollo Date: Wed, 17 Oct 2012 20:13:55 +0000 Subject: [PATCH 5/6] CODE STYLE Formating workflow/engine/methods/authSources/authSources_ImportUsers.php Change format files in workflow/engine/methods/authSources/authSources_ImportUsers.php --- .../authSources/authSources_ImportUsers.php | 146 +++++++++--------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/workflow/engine/methods/authSources/authSources_ImportUsers.php b/workflow/engine/methods/authSources/authSources_ImportUsers.php index 98d2299ae..79ba7719d 100755 --- a/workflow/engine/methods/authSources/authSources_ImportUsers.php +++ b/workflow/engine/methods/authSources/authSources_ImportUsers.php @@ -1,73 +1,73 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; -} - -$aFields = $RBAC->getAuthSource($_POST['form']['AUTH_SOURCE_UID']); - -G::LoadThirdParty('pear/json','class.json'); -$oJSON = new Services_JSON(); - -foreach($_POST['aUsers'] as $sUser) { - $matches = array(); - $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 - $aData['USR_FIRSTNAME'] = str_replace("*","'",$aUser['sFirstname']); - $aData['USR_LASTNAME'] = str_replace("*","'",$aUser['sLastname'] ); - $aData['USR_EMAIL'] = $aUser['sEmail']; - $aData['USR_DUE_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2)); - $aData['USR_CREATE_DATE'] = date('Y-m-d H:i:s'); - $aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s'); - $aData['USR_BIRTHDAY'] = date('Y-m-d'); - $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 - preg_match('/[a-zA-Z]\*[a-zA-Z]/',$aUser['sDN'],$matches); - foreach ($matches as $key => $match){ - $newMatch = str_replace('*', '\'', $match); - $aUser['sDN'] = str_replace($match,$newMatch,$aUser['sDN']); - } - $aData['USR_AUTH_USER_DN'] = $aUser['sDN']; - $sUserUID = $RBAC->createUser($aData, 'PROCESSMAKER_OPERATOR'); - $aData['USR_STATUS'] = 'ACTIVE'; - $aData['USR_UID'] = $sUserUID; - $aData['USR_PASSWORD'] = md5($sUserUID);//fake :p - $aData['USR_ROLE'] = 'PROCESSMAKER_OPERATOR'; - require_once 'classes/model/Users.php'; - $oUser = new Users(); - $oUser->create($aData); -} - -G::header('Location: ../users/users_List'); \ No newline at end of file +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); +} + +$aFields = $RBAC->getAuthSource( $_POST['form']['AUTH_SOURCE_UID'] ); + +G::LoadThirdParty( 'pear/json', 'class.json' ); +$oJSON = new Services_JSON(); + +foreach ($_POST['aUsers'] as $sUser) { + $matches = array (); + $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 + $aData['USR_FIRSTNAME'] = str_replace( "*", "'", $aUser['sFirstname'] ); + $aData['USR_LASTNAME'] = str_replace( "*", "'", $aUser['sLastname'] ); + $aData['USR_EMAIL'] = $aUser['sEmail']; + $aData['USR_DUE_DATE'] = date( 'Y-m-d', mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) + 2 ) ); + $aData['USR_CREATE_DATE'] = date( 'Y-m-d H:i:s' ); + $aData['USR_UPDATE_DATE'] = date( 'Y-m-d H:i:s' ); + $aData['USR_BIRTHDAY'] = date( 'Y-m-d' ); + $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 + preg_match( '/[a-zA-Z]\*[a-zA-Z]/', $aUser['sDN'], $matches ); + foreach ($matches as $key => $match) { + $newMatch = str_replace( '*', '\'', $match ); + $aUser['sDN'] = str_replace( $match, $newMatch, $aUser['sDN'] ); + } + $aData['USR_AUTH_USER_DN'] = $aUser['sDN']; + $sUserUID = $RBAC->createUser( $aData, 'PROCESSMAKER_OPERATOR' ); + $aData['USR_STATUS'] = 'ACTIVE'; + $aData['USR_UID'] = $sUserUID; + $aData['USR_PASSWORD'] = md5( $sUserUID ); //fake :p + $aData['USR_ROLE'] = 'PROCESSMAKER_OPERATOR'; + require_once 'classes/model/Users.php'; + $oUser = new Users(); + $oUser->create( $aData ); +} + +G::header( 'Location: ../users/users_List' ); + From 0df3c88ad1e8ad589f30d632ec730b1233556e33 Mon Sep 17 00:00:00 2001 From: norahmollo Date: Wed, 17 Oct 2012 20:20:44 +0000 Subject: [PATCH 6/6] CODE STYLE Formating workflow/engine/methods/authSources/authSources_kindof.php Change format files in workflow/engine/methods/authSources/authSources_kindof.php --- .../authSources/authSources_kindof.php | 86 +++++++++---------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/workflow/engine/methods/authSources/authSources_kindof.php b/workflow/engine/methods/authSources/authSources_kindof.php index 9243b074c..5ffeb6350 100755 --- a/workflow/engine/methods/authSources/authSources_kindof.php +++ b/workflow/engine/methods/authSources/authSources_kindof.php @@ -1,43 +1,43 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -global $RBAC; -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; -} - -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'users'; -$G_ID_MENU_SELECTED = 'USERS'; -$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; - -$aAuthSourceTypes = array(array('sType' => 'char', 'sLabel' => 'char')); -$oDirectory = dir(PATH_RBAC . 'plugins' . PATH_SEP); -$G_PUBLISH = new Publisher(); -$oHeadPublisher =& headPublisher::getSingleton(); -$oHeadPublisher->addExtJsScript('authSources/authSourceskindof', true); //adding a javascript file .js -$oHeadPublisher->assign('sprovider', $_GET['sprovider']); -G::RenderPage('publish', 'extJs'); +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + */ +global $RBAC; +if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); +} + +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'users'; +$G_ID_MENU_SELECTED = 'USERS'; +$G_ID_SUB_MENU_SELECTED = 'AUTH_SOURCES'; + +$aAuthSourceTypes = array (array ('sType' => 'char','sLabel' => 'char')); +$oDirectory = dir( PATH_RBAC . 'plugins' . PATH_SEP ); +$G_PUBLISH = new Publisher(); +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addExtJsScript( 'authSources/authSourceskindof', true ); //adding a javascript file .js +$oHeadPublisher->assign( 'sprovider', $_GET['sprovider'] ); +G::RenderPage( 'publish', 'extJs' ); +