mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
N°9044 - Application token and Impersonate (Log in as this user)
This commit is contained in:
@@ -658,6 +658,16 @@ abstract class User extends cmdbAbstractObject
|
|||||||
}
|
}
|
||||||
return false;
|
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);
|
$oUser = self::FindUser($sLogin);
|
||||||
if ($oUser) {
|
if ($oUser) {
|
||||||
$bRet = true;
|
$bRet = true;
|
||||||
|
if (!$oUser->CanBeImpersonated()) {
|
||||||
|
throw new Exception($oUser->GetName().' cannot be impersonated');
|
||||||
|
}
|
||||||
if (is_null(self::$m_oRealUser)) {
|
if (is_null(self::$m_oRealUser)) {
|
||||||
// First impersonation
|
// First impersonation
|
||||||
self::$m_oRealUser = self::$m_oUser;
|
self::$m_oRealUser = self::$m_oUser;
|
||||||
|
|||||||
Reference in New Issue
Block a user