N°4036 - User edition controls : a user cannot change his own status (fix)

This commit is contained in:
Eric
2021-07-27 17:39:12 +02:00
parent d86f489c89
commit acb8a377dd

View File

@@ -351,7 +351,7 @@ abstract class User extends cmdbAbstractObject
// A User cannot disable himself
if ($this->IsCurrentUser()) {
if (isset($aChanges['status'])) {
if (isset($aChanges['status']) && ($this->Get('status') == 'disabled')) {
$this->m_aCheckIssues[] = Dict::S('Class:User/Error:StatusChangeIsNotAllowed');
}
}
@@ -418,8 +418,8 @@ abstract class User extends cmdbAbstractObject
}
}
$oAddon = UserRights::GetModuleInstance();
if (!UserRights::IsAdministrator()) {
$oAddon = UserRights::GetModuleInstance();
$oUser = UserRights::GetUserObject();
if (!is_null($oUser) && method_exists($oAddon, 'GetUserOrgs')) {
$aOrgs = $oAddon->GetUserOrgs($oUser, ''); // Modifier allowed orgs