From b207f9ea02064e7f57277a4842bf48c2afdcdd4d Mon Sep 17 00:00:00 2001 From: vdumas Date: Mon, 22 Jul 2024 15:18:42 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B07131=20-=20Allow=20Data=20Synchro=20to?= =?UTF-8?q?=20change=20the=20Org=20of=20a=20Person=20regardless=20of=20its?= =?UTF-8?q?=20Users?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- datamodels/2.x/itop-structure/datamodel.itop-structure.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/datamodels/2.x/itop-structure/datamodel.itop-structure.xml b/datamodels/2.x/itop-structure/datamodel.itop-structure.xml index d32eb5a1b..91e7a445f 100644 --- a/datamodels/2.x/itop-structure/datamodel.itop-structure.xml +++ b/datamodels/2.x/itop-structure/datamodel.itop-structure.xml @@ -736,8 +736,8 @@ $oSearch->AllowAllData(); $oUserSet = new DBObjectSet($oSearch); - // The organization's person was changed and it has associated Users - if (array_key_exists('org_id', $aChanges) && ($oUserSet->Count() > 0)) { + // Change was not made by a DataSynchro and the organization's person was changed and there are associated Users + if (!ContextTag::Check(ContextTag::TAG_SYNCHRO) && array_key_exists('org_id', $aChanges) && ($oUserSet->Count() > 0)) { while($oUser = $oUserSet->Fetch()) { $oAddon = UserRights::GetModuleInstance(); @@ -746,7 +746,7 @@ $aProfiles = $oSet->GetColumnAsArray('profile'); // User is not allowed on the new Organization and has 'Portal user' Profile and is enabled - if ((count($aOrgs) > 0) && !in_array($this->Get('org_id'), $aOrgs) && in_array('Portal user',$aProfiles) && ($oUser->Get('status') === 'enabled') && !ContextTag::Check(ContextTag::TAG_SYNCHRO)) + if ((count($aOrgs) > 0) && !in_array($this->Get('org_id'), $aOrgs) && in_array('Portal user',$aProfiles) && ($oUser->Get('status') === 'enabled')) { // Let's block the Person modification, // replace by $this->AddCheckWarning(...) if you don't want to block the modification $this->AddCheckIssue(Dict::Format('Class:Person/Error:ChangingOrgDenied', $this->Get('org_id_friendlyname')));