N°2163 DB*Tracked methods : modifications after review with Romain

Previous commit : 24eb82d1
Use \CMDBObject::SetTrackInfo
Move \CMDBObject::SetCurrentChange calls at the top most level of the stacks
Restore old behaviors that were removed in previous commit
This commit is contained in:
Pierre Goiffon
2019-11-25 09:41:20 +01:00
parent 2f2d9547b7
commit 0ee77d8c88
13 changed files with 39 additions and 76 deletions

View File

@@ -121,20 +121,14 @@ class UserRightsMatrix extends UserRightsAddOnAPI
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
{
// Maybe we should check that no other user with userid == 0 exists
CMDBObject::SetTrackInfo('Initialization');
$oUser = new UserLocal();
$oUser->Set('login', $sAdminUser);
$oUser->Set('password', $sAdminPwd);
$oUser->Set('contactid', 1); // one is for root !
$oUser->Set('language', $sLanguage); // Language was chosen during the installation
// Create a change to record the history of the User object
/** @var \CMDBChange $oChange */
$oChange = MetaModel::NewObject("CMDBChange");
$oChange->Set("date", time());
$oChange->Set("userinfo", "Initialization");
// Now record the admin user object
$oUser::SetCurrentChange($oChange);
$iUserId = $oUser->DBInsertNoReload();
$this->SetupUser($iUserId, true);
return true;