From a01d0af0888b222244d8285d424239b6576aa105 Mon Sep 17 00:00:00 2001 From: davidcallizaya Date: Tue, 3 Oct 2017 16:27:53 -0400 Subject: [PATCH] HOR-3951 Fix import users from ldap: username case sensitive. --- .../translations/english/processmaker.en.po | 18 ++++++++++++++++++ workflow/engine/data/mysql/insert.sql | 5 ++++- .../methods/authSources/ldapAdvancedProxy.php | 14 +++++++++----- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 27ab40cf4..bf7890e93 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -27851,6 +27851,24 @@ msgstr "Case created" msgid "Case routed to" msgstr "Case routed to" +# TRANSLATION +# LABEL/ID_IMPORTED +#: LABEL/ID_IMPORTED +msgid "IMPORTED" +msgstr "IMPORTED" + +# TRANSLATION +# LABEL/ID_NOT_IMPORTED +#: LABEL/ID_NOT_IMPORTED +msgid "NOT IMPORTED" +msgstr "NOT IMPORTED" + +# TRANSLATION +# LABEL/ID_CANNOT_IMPORT +#: LABEL/ID_CANNOT_IMPORT +msgid "CANNOT IMPORT" +msgstr "CANNOT IMPORT" + # additionalTables/additionalTablesData.xml?ADD_TAB_NAME # additionalTables/additionalTablesData.xml #: text - ADD_TAB_NAME diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 2ddb8006f..524d1777b 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -6182,7 +6182,10 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_VIEW_RESPONSE','en','View Response','2017-02-22') , ( 'LABEL','ID_ERROR_MESSAGE','en','Error Message','2017-02-22') , ( 'LABEL','ID_CASE_CREATED','en','Case created','2017-06-02') , -( 'LABEL','ID_CASE_ROUTED_TO','en','Case routed to','2017-06-02'); +( 'LABEL','ID_CASE_ROUTED_TO','en','Case routed to','2017-06-02'), +( 'LABEL','ID_IMPORTED','en','IMPORTED','2017-10-03'), +( 'LABEL','ID_NOT_IMPORTED','en','NOT IMPORTED','2017-10-03'), +( 'LABEL','ID_CANNOT_IMPORT','en','CANNOT IMPORT','2017-10-03'); INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('AD','','',' ','') , diff --git a/workflow/engine/methods/authSources/ldapAdvancedProxy.php b/workflow/engine/methods/authSources/ldapAdvancedProxy.php index 16d081334..6d8083be4 100644 --- a/workflow/engine/methods/authSources/ldapAdvancedProxy.php +++ b/workflow/engine/methods/authSources/ldapAdvancedProxy.php @@ -191,6 +191,8 @@ switch ($function) { $criteria = new Criteria("workflow"); $criteria->addSelectColumn(UsersPeer::USR_USERNAME); + $criteria->addSelectColumn(RbacUsersPeer::UID_AUTH_SOURCE); + $criteria->addJoin(UsersPeer::USR_UID, RbacUsersPeer::USR_UID); $criteria->add(UsersPeer::USR_STATUS, "CLOSED", Criteria::NOT_EQUAL); $rsCriteria = UsersPeer::doSelectRS($criteria); @@ -198,8 +200,7 @@ switch ($function) { while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); - - $arrayUser[$row["USR_USERNAME"]] = 1; + $arrayUser[strtolower($row["USR_USERNAME"])] = $row['UID_AUTH_SOURCE']; } //Get data @@ -213,11 +214,14 @@ switch ($function) { foreach ($result["data"] as $value) { $arrayUserData = $value; - if (!isset($arrayUser[$arrayUserData["sUsername"]])) { - $arrayUserData["STATUS"] = "NOT IMPORTED"; + if (!isset($arrayUser[strtolower($arrayUserData["sUsername"])])) { + $arrayUserData["STATUS"] = G::LoadTranslation("ID_NOT_IMPORTED"); $arrayUserData["IMPORT"] = 1; + } elseif($authenticationSourceUid === $arrayUser[strtolower($arrayUserData["sUsername"])]) { + $arrayUserData["STATUS"] = G::LoadTranslation("ID_IMPORTED"); + $arrayUserData["IMPORT"] = 0; } else { - $arrayUserData["STATUS"] = "IMPORTED"; + $arrayUserData["STATUS"] = G::LoadTranslation("ID_CANNOT_IMPORT"); $arrayUserData["IMPORT"] = 0; }