mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
Fixed bug: grant matrix apparently not updated (but it was) when modifying/creating a user account
SVN:trunk[706]
This commit is contained in:
@@ -836,11 +836,6 @@ abstract class DBObject
|
||||
return $this->m_iKey;
|
||||
}
|
||||
|
||||
// To be optionaly overloaded
|
||||
protected function OnInsert()
|
||||
{
|
||||
}
|
||||
|
||||
// Insert of record for the new object into the database
|
||||
// Returns the key of the newly created object
|
||||
public function DBInsertNoReload()
|
||||
@@ -899,6 +894,8 @@ abstract class DBObject
|
||||
$this->m_bIsInDB = true;
|
||||
$this->m_bDirty = false;
|
||||
|
||||
$this->AfterInsert();
|
||||
|
||||
// Activate any existing trigger
|
||||
$sClass = get_class($this);
|
||||
$oSet = new DBObjectSet(new DBObjectSearch('TriggerOnObjectCreate'));
|
||||
@@ -941,11 +938,6 @@ abstract class DBObject
|
||||
$this->m_iKey = self::GetNextTempId(get_class($this));
|
||||
}
|
||||
|
||||
// To be optionaly overloaded
|
||||
protected function OnUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
// Update a record
|
||||
public function DBUpdate()
|
||||
{
|
||||
@@ -992,6 +984,8 @@ abstract class DBObject
|
||||
$this->DBWriteLinks();
|
||||
$this->m_bDirty = false;
|
||||
|
||||
$this->AfterUpdate();
|
||||
|
||||
// Reload to get the external attributes
|
||||
if ($bHasANewExternalKeyValue)
|
||||
{
|
||||
@@ -1013,16 +1007,20 @@ abstract class DBObject
|
||||
return $this->DBInsert();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Delete a record
|
||||
public function DBDelete()
|
||||
{
|
||||
$oFilter = new DBObjectSearch(get_class($this));
|
||||
$oFilter->AddCondition('id', $this->m_iKey, '=');
|
||||
|
||||
$this->OnDelete();
|
||||
|
||||
$sSQL = MetaModel::MakeDeleteQuery($oFilter);
|
||||
CMDBSource::Query($sSQL);
|
||||
|
||||
$this->AfterDelete();
|
||||
|
||||
$this->m_bIsInDB = false;
|
||||
$this->m_iKey = null;
|
||||
}
|
||||
@@ -1106,6 +1104,35 @@ abstract class DBObject
|
||||
return $aScalarArgs;
|
||||
}
|
||||
|
||||
// To be optionaly overloaded
|
||||
protected function OnInsert()
|
||||
{
|
||||
}
|
||||
|
||||
// To be optionaly overloaded
|
||||
protected function AfterInsert()
|
||||
{
|
||||
}
|
||||
|
||||
// To be optionaly overloaded
|
||||
protected function OnUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
// To be optionaly overloaded
|
||||
protected function AfterUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
// To be optionaly overloaded
|
||||
protected function OnDelete()
|
||||
{
|
||||
}
|
||||
|
||||
// To be optionaly overloaded
|
||||
protected function AfterDelete()
|
||||
{
|
||||
}
|
||||
|
||||
// Return an empty set for the parent of all
|
||||
public static function GetRelationQueries($sRelCode)
|
||||
|
||||
@@ -164,7 +164,7 @@ abstract class User extends cmdbAbstractObject
|
||||
'stimuli' => $sStimuli,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$aDisplayConfig = array();
|
||||
$aDisplayConfig['class'] = array('label' => Dict::S('UI:UserManagement:Class'), 'description' => Dict::S('UI:UserManagement:Class+'));
|
||||
$aDisplayConfig['read'] = array('label' => Dict::S('UI:UserManagement:Action:Read'), 'description' => Dict::S('UI:UserManagement:Action:Read+'));
|
||||
@@ -274,14 +274,18 @@ class UserRights
|
||||
// Installation: create the very first user
|
||||
public static function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
|
||||
{
|
||||
return self::$m_oAddOn->CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage);
|
||||
$bRes = self::$m_oAddOn->CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage);
|
||||
self::FlushPrivileges(true /* reset admin cache */);
|
||||
return $bRes;
|
||||
}
|
||||
|
||||
// Installation (e.g: give default values for users)
|
||||
public static function Setup()
|
||||
{
|
||||
// to be discussed...
|
||||
return self::$m_oAddOn->Setup();
|
||||
$bRes = self::$m_oAddOn->Setup();
|
||||
self::FlushPrivileges(true /* reset admin cache */);
|
||||
return $bRes;
|
||||
}
|
||||
|
||||
protected static function IsLoggedIn()
|
||||
@@ -575,6 +579,7 @@ class UserRights
|
||||
return self::$m_oAddOn->IsActionAllowedOnAttribute($oUser, $sClass, $sAttCode, $iActionCode, $oInstanceSet);
|
||||
}
|
||||
|
||||
static $m_aAdmins = array();
|
||||
public static function IsAdministrator($oUser = null)
|
||||
{
|
||||
if (!self::CheckLogin()) return false;
|
||||
@@ -583,11 +588,20 @@ class UserRights
|
||||
{
|
||||
$oUser = self::$m_oUser;
|
||||
}
|
||||
return self::$m_oAddOn->IsAdministrator($oUser);
|
||||
$iUser = $oUser->GetKey();
|
||||
if (!isset(self::$m_aAdmins[$iUser]))
|
||||
{
|
||||
self::$m_aAdmins[$iUser] = self::$m_oAddOn->IsAdministrator($oUser);
|
||||
}
|
||||
return self::$m_aAdmins[$iUser];
|
||||
}
|
||||
|
||||
public static function FlushPrivileges()
|
||||
public static function FlushPrivileges($bResetAdminCache = false)
|
||||
{
|
||||
if ($bResetAdminCache)
|
||||
{
|
||||
self::$m_aAdmins = array();
|
||||
}
|
||||
return self::$m_oAddOn->FlushPrivileges();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user