Fix PHP CS

This commit is contained in:
v-dumas
2025-11-17 15:04:19 +01:00
parent 53de040934
commit ed360edb83
3 changed files with 10 additions and 14 deletions

View File

@@ -427,8 +427,7 @@ abstract class User extends cmdbAbstractObject
$this->m_aCheckIssues[] = Dict::S('Class:User/Error:AdminProfileCannotBeRemovedBySelf');
}
}
}
elseif ($this->IsPrivilegedUser()) {
} elseif ($this->IsPrivilegedUser()) {
// Prevent Privileged User to be saved with profiles denying the access to the backoffice
$oSet->Rewind();
while ($oUserProfile = $oSet->Fetch()) {

View File

@@ -661,17 +661,15 @@ abstract class ItopDataTestCase extends ItopTestCase
{
/** @var \ormLinkSet $oSet */
$oSet = $oUser->Get('profile_list');
foreach ($oSet as $oUserProfile)
{
if ($oUserProfile->Get('profileid') == $iProfileId)
{
foreach ($oSet as $oUserProfile) {
if ($oUserProfile->Get('profileid') == $iProfileId) {
$oSet->RemoveItem($oUserProfile->GetKey());
break;
}
}
$oUser = $this->updateObject(User::class, $oUser->GetKey(), array(
$oUser = $this->updateObject(User::class, $oUser->GetKey(), [
'profile_list' => $oSet,
));
]);
return $oUser;
}

View File

@@ -87,12 +87,12 @@ class UserRightsTest extends ItopDataTestCase
foreach ($aProfileIds as $iProfileId) {
$oProfiles->AddItem(MetaModel::NewObject('URP_UserProfile', ['profileid' => $iProfileId, 'reason' => 'UNIT Tests']));
}
$oUser = MetaModel::NewObject('UserLocal', array(
$oUser = MetaModel::NewObject('UserLocal', [
'login' => $sLogin,
'password' => 'Password1!',
'expiration' => UserLocal::EXPIRE_NEVER,
'profile_list' => $oProfiles,
));
]);
return $oUser;
}
@@ -417,7 +417,6 @@ class UserRightsTest extends ItopDataTestCase
$this->RemoveProfileFromUser($oUser, $iProfileId);
}
public function UserCannotLoseUserEditionRightsProvider(): array
{
return [