From 823311dc86e8bafd4f1e91d2d38c88142c5bfe6f Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Thu, 18 Oct 2018 15:12:54 +0200 Subject: [PATCH 1/7] Update jenkins conf --- .../default-config-itop.php | 8 +-- .../unattended_install/default-params.xml | 67 ++++++++++--------- 2 files changed, 39 insertions(+), 36 deletions(-) diff --git a/.jenkins/configuration/default-environment/unattended_install/default-config-itop.php b/.jenkins/configuration/default-environment/unattended_install/default-config-itop.php index 71a82612b..adb939864 100644 --- a/.jenkins/configuration/default-environment/unattended_install/default-config-itop.php +++ b/.jenkins/configuration/default-environment/unattended_install/default-config-itop.php @@ -82,11 +82,11 @@ $MySettings = array( 'db_name' => 'itop_ci_main', - 'db_pwd' => 'c8mb0do', + 'db_pwd' => 'IKnowYouSeeMeInJenkinsConf', 'db_subname' => '', - 'db_user' => 'root', + 'db_user' => 'jenkins_itop', // deadline_format: The format used for displaying "deadline" attributes: any string with the following placeholders: $date$, $difference$ // default: '$difference$' @@ -124,7 +124,7 @@ $MySettings = array( // email_transport_smtp.password: Authentication password (optional) // default: '' - 'email_transport_smtp.password' => '++combodo++', + 'email_transport_smtp.password' => 'IDoNotWork', // email_transport_smtp.port: port number (optional) // default: 25 @@ -282,4 +282,4 @@ $MyModules = array( 'user rights' => 'addons/userrights/userrightsprofile.class.inc.php', ), ); -?> \ No newline at end of file +?> diff --git a/.jenkins/configuration/default-environment/unattended_install/default-params.xml b/.jenkins/configuration/default-environment/unattended_install/default-params.xml index fc188ba02..83bc798d3 100644 --- a/.jenkins/configuration/default-environment/unattended_install/default-params.xml +++ b/.jenkins/configuration/default-environment/unattended_install/default-params.xml @@ -1,5 +1,6 @@ + upgrade @@ -12,8 +13,8 @@ - root - c8mb0do + jenkins_itop + IKnowYouSeeMeInJenkinsConf itop_ci @@ -28,37 +29,39 @@ EN US - authent-external - authent-local - itop-backup - itop-config - itop-profiles-itil - itop-sla-computation - itop-tickets - itop-welcome-itil - itop-config-mgmt - itop-attachments - itop-datacenter-mgmt - itop-endusers-devices - itop-storage-mgmt - itop-virtualization-mgmt - itop-bridge-virtualization-storage - itop-service-mgmt - itop-request-mgmt - itop-portal - itop-portal-base - itop-change-mgmt + authent-external + authent-local + itop-backup + itop-config + itop-profiles-itil + itop-sla-computation + itop-tickets + itop-welcome-itil + itop-config-mgmt + itop-attachments + itop-datacenter-mgmt + itop-endusers-devices + itop-storage-mgmt + itop-virtualization-mgmt + itop-bridge-virtualization-storage + itop-service-mgmt + itop-request-mgmt + itop-portal + itop-portal-base + itop-change-mgmt + itop-knownerror-mgmt - itop-config-mgmt-core - itop-config-mgmt-datacenter - itop-config-mgmt-end-user - itop-config-mgmt-storage - itop-config-mgmt-virtualization - itop-service-mgmt-enterprise - itop-ticket-mgmt-simple-ticket - itop-ticket-mgmt-simple-ticket-enhanced-portal - itop-change-mgmt-simple + itop-config-mgmt-core + itop-config-mgmt-datacenter + itop-config-mgmt-end-user + itop-config-mgmt-storage + itop-config-mgmt-virtualization + itop-service-mgmt-enterprise + itop-ticket-mgmt-simple-ticket + itop-ticket-mgmt-simple-ticket-enhanced-portal + itop-change-mgmt-simple + itop-kown-error-mgmt 1 @@ -66,4 +69,4 @@ 1 - \ No newline at end of file + From 78b626bbd29a3354ab87758530a596beac18528b Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Thu, 18 Oct 2018 15:44:35 +0200 Subject: [PATCH 2/7] JenkinsFile : add fixed notification --- Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2f49a0667..94ac751e6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,6 +51,9 @@ pipeline { failure { slackSend(channel: "#jenkins-itop", color: '#FF0000', message: "Ho no! Build failed! (${currentBuild.result}), Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") } + fixed { + slackSend(channel: "#jenkins-itop", color: '#FFa500', message: "Yes! Build repaired! (${currentBuild.result}), Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})") + } } environment { @@ -59,4 +62,4 @@ pipeline { options { timeout(time: 20, unit: 'MINUTES') } -} \ No newline at end of file +} From 5f7e8c9229f292a691df1bdf1f09c1da33e52142 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Fri, 2 Nov 2018 08:50:56 +0100 Subject: [PATCH 3/7] =?UTF-8?q?N=C2=B01715=20Search:=20Add=20default=20cri?= =?UTF-8?q?teria=20for=20FAQ,=20FAQCategory=20&=20KnownError=20classes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datamodel.itop-knownerror-mgmt.xml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/datamodels/2.x/itop-knownerror-mgmt/datamodel.itop-knownerror-mgmt.xml b/datamodels/2.x/itop-knownerror-mgmt/datamodel.itop-knownerror-mgmt.xml index 60bb7f632..b43fccb93 100755 --- a/datamodels/2.x/itop-knownerror-mgmt/datamodel.itop-knownerror-mgmt.xml +++ b/datamodels/2.x/itop-knownerror-mgmt/datamodel.itop-knownerror-mgmt.xml @@ -192,6 +192,19 @@ + + + + 10 + + + 20 + + + 30 + + + @@ -488,6 +501,22 @@ + + + + 10 + + + 20 + + + 30 + + + 40 + + + @@ -558,6 +587,13 @@ + + + + 10 + + + From 841127c1319c7719a89839f75158adc69dd7366d Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 2 Nov 2018 16:01:56 +0100 Subject: [PATCH 4/7] =?UTF-8?q?N=C2=B0828=20-=20GetSelectFilter=20issue=20?= =?UTF-8?q?with=20DBUnionSearch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/dbsearch.class.php | 28 ++++++++++++++++++++++++++-- core/dbunionsearch.class.php | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/core/dbsearch.class.php b/core/dbsearch.class.php index cbc340eed..c6648a8ee 100644 --- a/core/dbsearch.class.php +++ b/core/dbsearch.class.php @@ -607,11 +607,30 @@ abstract class DBSearch return $sRes; } + protected abstract function IsDataFiltered(); + protected abstract function SetDataFiltered(); protected function GetSQLQuery($aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart, $bGetCount, $aGroupByExpr = null, $aSelectExpr = null) { - $oSQLQuery = $this->GetSQLQueryStructure($aAttToLoad, $bGetCount, $aGroupByExpr, null, $aSelectExpr); - $oSQLQuery->SetSourceOQL($this->ToOQL()); + $oSearch = $this; + if (!$this->IsAllDataAllowed() && !$this->IsDataFiltered()) + { + $oVisibleObjects = UserRights::GetSelectFilter($this->GetClass(), $this->GetModifierProperties('UserRightsGetSelectFilter')); + if ($oVisibleObjects === false) + { + // Make sure this is a valid search object, saying NO for all + $oVisibleObjects = DBObjectSearch::FromEmptySet($this->GetClass()); + } + if (is_object($oVisibleObjects)) + { + $oVisibleObjects->AllowAllData(); + $oSearch = $this->Intersect($oVisibleObjects); + /** @var DBSearch $oSearch */ + $oSearch->SetDataFiltered(); + } + } + $oSQLQuery = $oSearch->GetSQLQueryStructure($aAttToLoad, $bGetCount, $aGroupByExpr, null, $aSelectExpr); + $oSQLQuery->SetSourceOQL($oSearch->ToOQL()); // Join to an additional table, if required... // @@ -635,6 +654,11 @@ abstract class DBSearch $aAttToLoad, $bGetCount, $aGroupByExpr = null, $aSelectedClasses = null, $aSelectExpr = null ); + /** + * @return \Expression + */ + public abstract function GetCriteria(); + //////////////////////////////////////////////////////////////////////////// // // Cache/Trace/Log queries diff --git a/core/dbunionsearch.class.php b/core/dbunionsearch.class.php index f45ff7fab..2fe7f60b2 100644 --- a/core/dbunionsearch.class.php +++ b/core/dbunionsearch.class.php @@ -312,9 +312,9 @@ class DBUnionSearch extends DBSearch /** * Specify a condition on external keys or link sets - * @param sAttSpec Can be either an attribute code or extkey->[sAttSpec] or linkset->[sAttSpec] and so on, recursively + * @param String sAttSpec Can be either an attribute code or extkey->[sAttSpec] or linkset->[sAttSpec] and so on, recursively * Example: infra_list->ci_id->location_id->country - * @param value The value to match (can be an array => IN(val1, val2...) + * @param Object value The value to match (can be an array => IN(val1, val2...) * @return void */ public function AddConditionAdvanced($sAttSpec, $value) @@ -598,4 +598,34 @@ class DBUnionSearch extends DBSearch if (self::$m_bDebugQuery) $oSQLQuery->DisplayHtml(); return $oSQLQuery; } + + /** + * @return \Expression + */ + public function GetCriteria() + { + return new TrueExpression(); + } + + protected function IsDataFiltered() + { + $bIsAllDataFiltered = true; + foreach ($this->aSearches as $oSearch) + { + if (!$oSearch->IsDataFiltered()) + { + $bIsAllDataFiltered = false; + break; + } + } + return $bIsAllDataFiltered; + } + + protected function SetDataFiltered() + { + foreach ($this->aSearches as $oSearch) + { + $oSearch->SetDataFiltered(); + } + } } From 95fce0eefbe04c93e7d423f8f670e9de1af7abf6 Mon Sep 17 00:00:00 2001 From: Eric Date: Fri, 2 Nov 2018 17:36:07 +0100 Subject: [PATCH 5/7] Fix audit bug (DBUnionSearch::AddConditionForInOperatorUsingParam() does not exist) when category is a UNION and rule flag 'Valid objects?' is 'true' and there are invalid entries in the result of the audit. --- core/dbobjectsearch.class.php | 15 --------------- core/dbsearch.class.php | 9 +++++++++ core/dbunionsearch.class.php | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/core/dbobjectsearch.class.php b/core/dbobjectsearch.class.php index 39acb773c..9300783c2 100644 --- a/core/dbobjectsearch.class.php +++ b/core/dbobjectsearch.class.php @@ -516,21 +516,6 @@ class DBObjectSearch extends DBSearch $this->AddConditionExpression($oInCondition); } - /** - * @return string a unique param name - */ - private function GenerateUniqueParamName() { - $iExistingParamsNb = count($this->m_aParams); - $iCurrentArrayParamNb = $iExistingParamsNb + 1; - $sParamName = 'param'.$iCurrentArrayParamNb; - - if (isset($this->m_aParams[$sParamName])) { - $sParamName .= '_'.microtime(true) . '_' .rand(0,100); - } - - return $sParamName; - } - /** * Specify a condition on external keys or link sets * @param string $sAttSpec Can be either an attribute code or extkey->[sAttSpec] or linkset->[sAttSpec] and so on, recursively diff --git a/core/dbsearch.class.php b/core/dbsearch.class.php index c6648a8ee..7485612d1 100644 --- a/core/dbsearch.class.php +++ b/core/dbsearch.class.php @@ -659,6 +659,15 @@ abstract class DBSearch */ public abstract function GetCriteria(); + public abstract function AddConditionForInOperatorUsingParam($sFilterCode, $aValues, $bPositiveMatch = true); + + /** + * @return string a unique param name + */ + protected function GenerateUniqueParamName() { + return str_replace('.', '', 'param_'.microtime(true).rand(0,100)); + } + //////////////////////////////////////////////////////////////////////////// // // Cache/Trace/Log queries diff --git a/core/dbunionsearch.class.php b/core/dbunionsearch.class.php index 2fe7f60b2..597e2f746 100644 --- a/core/dbunionsearch.class.php +++ b/core/dbunionsearch.class.php @@ -628,4 +628,22 @@ class DBUnionSearch extends DBSearch $oSearch->SetDataFiltered(); } } + + public function AddConditionForInOperatorUsingParam($sFilterCode, $aValues, $bPositiveMatch = true) + { + $sInParamName = $this->GenerateUniqueParamName(); + foreach ($this->aSearches as $iSearchIndex => $oSearch) + { + $oFieldExpression = new FieldExpression($sFilterCode, $oSearch->GetClassAlias()); + + $sOperator = $bPositiveMatch ? 'IN' : 'NOT IN'; + + $oParamExpression = new VariableExpression($sInParamName); + $oSearch->GetInternalParamsByRef()[$sInParamName] = $aValues; + + $oListExpression = new ListExpression(array($oParamExpression)); + $oInCondition = new BinaryExpression($oFieldExpression, $sOperator, $oListExpression); + $oSearch->AddConditionExpression($oInCondition); + } + } } From 216d965d76a652310cdd87f0c6dbb4d53de04e3f Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 5 Nov 2018 17:43:50 +0100 Subject: [PATCH 6/7] =?UTF-8?q?N=C2=B01724=20-=20Fix=20external=20key=20se?= =?UTF-8?q?arch=20error=20when=20an=20UNION=20is=20used=20as=20a=20filter?= =?UTF-8?q?=20in=20the=20datamodel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/dbunionsearch.class.php | 4 +++- pages/ajax.searchform.php | 4 ++-- sources/application/search/searchform.class.inc.php | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/dbunionsearch.class.php b/core/dbunionsearch.class.php index 597e2f746..32721c45e 100644 --- a/core/dbunionsearch.class.php +++ b/core/dbunionsearch.class.php @@ -604,7 +604,9 @@ class DBUnionSearch extends DBSearch */ public function GetCriteria() { - return new TrueExpression(); + // We're at the limit here + $oSearch = reset($this->aSearches); + return $oSearch->GetCriteria(); } protected function IsDataFiltered() diff --git a/pages/ajax.searchform.php b/pages/ajax.searchform.php index a4989751b..68d6fdaf2 100644 --- a/pages/ajax.searchform.php +++ b/pages/ajax.searchform.php @@ -91,11 +91,11 @@ try $oObj = $oWizardHelper->GetTargetObject(); if (array_key_exists('query_params', $aExtraParams)) { - $aExtraParams['query_params']['this'] = $oObj; + $aExtraParams['query_params']['this->object()'] = $oObj; } else { - $aExtraParams['query_params'] = array('this' => $oObj); + $aExtraParams['query_params'] = array('this->object()' => $oObj); } // // Current extkey value, so we can display event if it is not available anymore (eg. archived). diff --git a/sources/application/search/searchform.class.inc.php b/sources/application/search/searchform.class.inc.php index cb4b88df1..8e9c00ce6 100644 --- a/sources/application/search/searchform.class.inc.php +++ b/sources/application/search/searchform.class.inc.php @@ -202,7 +202,7 @@ class SearchForm } $oBaseSearch = $oSearch->DeepClone(); - if (method_exists($oSearch, 'GetCriteria')) + if ($oSearch instanceof DBObjectSearch) { $oBaseSearch->ResetCondition(); } @@ -487,7 +487,7 @@ class SearchForm $bIsEmptyExpression = true; $aArgs = MetaModel::PrepareQueryArguments($aArgs, $oSearch->GetInternalParams()); - if (method_exists($oSearch, 'GetCriteria')) + if ($oSearch instanceof DBObjectSearch) { $oExpression = $oSearch->GetCriteria(); From 6f79c16ba04fd3212862fab327a85ce983834d7f Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Fri, 9 Nov 2018 17:39:03 +0100 Subject: [PATCH 7/7] =?UTF-8?q?N=C2=B01746=20add=20a=20log=20when=20CK=20i?= =?UTF-8?q?mage=20upload=20fails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/ajax.render.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pages/ajax.render.php b/pages/ajax.render.php index a2062e4bc..80f478edd 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -2453,7 +2453,9 @@ EOF } } catch (FileUploadException $e) { - // fail silently ?? + $sCurrentUserLogin = UserRights::GetUser(); + $sErrorMessage = "CKE : error when uploading image in ajax.render.php - operation=cke_upload_and_browse,User='$sCurrentUserLogin', class='$sObjClass',exception=$e"; + IssueLog::Error($sErrorMessage); } // Fall though !! => browse