diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 82de32529..d258c1823 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -4267,16 +4267,17 @@ abstract class MetaModel ]; IssueLog::Warning("Unresolved placeholders due to null object in current context", null, $aContext); - $aPlaceholders[$sPlaceHolderKey] = \Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey); + $aPlaceholders[$sPlaceHolderKey] = Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey); foreach ($aCurrentUser as $sField) { $sPlaceHolderKey = $sPlaceHolderPrefix . "->$sField"; - $aPlaceholders[$sPlaceHolderKey] = \Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey); + $aPlaceholders[$sPlaceHolderKey] = Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey); } } else { $aPlaceholders[$sPlaceHolderKey] = $oObject; foreach ($aCurrentUser as $sField) { $sPlaceHolderKey = $sPlaceHolderPrefix . "->$sField"; - if (false === MetaModel::IsValidAttCode(get_class($oObject), $sField)){ + // Mind that the "id" is not viewed as a valid att. code by \MetaModel::IsValidAttCode() so we have to test it manually + if ($sField !== "id" && false === MetaModel::IsValidAttCode(get_class($oObject), $sField)){ $aContext = [ "current_user_id" => UserRights::GetUserId(), "obj_class" => get_class($oObject), @@ -4285,7 +4286,7 @@ abstract class MetaModel ]; IssueLog::Warning("Unresolved placeholder due to invalid attribute", null, $aContext); - $aPlaceholders[$sPlaceHolderKey] = \Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey); + $aPlaceholders[$sPlaceHolderKey] = Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey); continue; } diff --git a/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php b/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php index 88801755f..eb853ab24 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php +++ b/datamodels/2.x/itop-portal-base/portal/src/Form/ObjectFormManager.php @@ -1404,7 +1404,7 @@ class ObjectFormManager extends FormManager } } /** @var SecurityHelper $oSecurityHelper */ - $oSecurityHelper = $this->oContainer->get('security_helper'); + $oSecurityHelper = $this->oFormHandlerHelper->GetSecurityHelper(); // N°7023 - Note that we check for ext. key now as we want the check to be done on user inputs and NOT on ext. keys set programatically, so it must be done before the DoComputeValues $this->oObject->CheckChangedExtKeysValues(function ($sClass, $sId) use ($oSecurityHelper): bool { return $oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sClass, $sId); diff --git a/tests/php-unit-tests/unitary-tests/application/query/QueryTest.php b/tests/php-unit-tests/unitary-tests/application/query/QueryTest.php index 893b2d019..ece49c6a3 100644 --- a/tests/php-unit-tests/unitary-tests/application/query/QueryTest.php +++ b/tests/php-unit-tests/unitary-tests/application/query/QueryTest.php @@ -178,6 +178,9 @@ class QueryTest extends ItopDataTestCase curl_setopt($curl, CURLOPT_USERPWD, self::USER . ':' . self::PASSWORD); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + // Force disable of certificate check as most of dev / test env have a self-signed certificate + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // execute curl $result = curl_exec($curl); diff --git a/tests/php-unit-tests/unitary-tests/core/MetaModelMagicPlaceholderTest.php b/tests/php-unit-tests/unitary-tests/core/MetaModelMagicPlaceholderTest.php index 1f3cd433f..68c7eae5a 100644 --- a/tests/php-unit-tests/unitary-tests/core/MetaModelMagicPlaceholderTest.php +++ b/tests/php-unit-tests/unitary-tests/core/MetaModelMagicPlaceholderTest.php @@ -79,7 +79,10 @@ class MetaModelMagicPlaceholderTest extends ItopDataTestCase new VariableExpression('current_user->login'), new VariableExpression('current_user->not_existing_attribute'), new VariableExpression('current_contact_id'), + new VariableExpression('current_contact->id'), + new VariableExpression('current_contact->friendlyname'), new VariableExpression('current_contact->org_id'), + new VariableExpression('current_contact->org_id_friendlyname'), new VariableExpression('current_contact->not_existing_attribute'), ]; $aPlaceholders = MetaModel::AddMagicPlaceholders(['gabu' => "zomeu"], $aExpectedArgs); @@ -91,7 +94,10 @@ class MetaModelMagicPlaceholderTest extends ItopDataTestCase 'current_user->not_existing_attribute' => '(current_user->not_existing_attribute : cannot be resolved)', 'current_user->login' => $sLogin, 'current_contact->object()' => $oPerson, + 'current_contact->id' => $oPerson->GetKey(), + 'current_contact->friendlyname' => $oPerson->GetName(), 'current_contact->org_id' => $oPerson->Get('org_id'), + 'current_contact->org_id_friendlyname' => $oPerson->Get('org_id_friendlyname'), 'current_contact->not_existing_attribute' => '(current_contact->not_existing_attribute : cannot be resolved)', ], $aPlaceholders,