mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-22 00:32:16 +02:00
Compare commits
2 Commits
faf/operat
...
feature/96
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c347b961b1 | ||
|
|
48e6203869 |
@@ -3240,7 +3240,13 @@ EOF
|
||||
$aAllowedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, $aArgs);
|
||||
if (is_array($aAllowedValues) && count($aAllowedValues) == 1) {
|
||||
$aValues = array_keys($aAllowedValues);
|
||||
$this->Set($sAttCode, $aValues[0]);
|
||||
if ($oAttDef->IsLinkSet()) {
|
||||
$oObjectSet = $this->Get($sAttCode);
|
||||
$oObjectSet->AddItem(MetaModel::GetObject($oAttDef->GetLinkedClass(), $aValues[0]));
|
||||
$this->Set($sAttCode, $oObjectSet);
|
||||
} else {
|
||||
$this->Set($sAttCode, $aValues[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,6 +658,16 @@ abstract class User extends cmdbAbstractObject
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow a user to be impersonated by another one (generally an administrator) in order to troubleshoot rights issues.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function CanBeImpersonated(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1063,6 +1073,9 @@ class UserRights
|
||||
$oUser = self::FindUser($sLogin);
|
||||
if ($oUser) {
|
||||
$bRet = true;
|
||||
if (!$oUser->CanBeImpersonated()) {
|
||||
throw new Exception($oUser->GetName().' cannot be impersonated');
|
||||
}
|
||||
if (is_null(self::$m_oRealUser)) {
|
||||
// First impersonation
|
||||
self::$m_oRealUser = self::$m_oUser;
|
||||
|
||||
Reference in New Issue
Block a user