本文整理汇总了PHP中UserRights::IsImpersonated方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRights::IsImpersonated方法的具体用法?PHP UserRights::IsImpersonated怎么用?PHP UserRights::IsImpersonated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRights
的用法示例。
在下文中一共展示了UserRights::IsImpersonated方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetCurrentUserName
public static function GetCurrentUserName()
{
if (UserRights::IsImpersonated()) {
$sUserString = Dict::Format('UI:Archive_User_OnBehalfOf_User', UserRights::GetRealUserFriendlyName(), UserRights::GetUserFriendlyName());
} else {
$sUserString = UserRights::GetUserFriendlyName();
}
return $sUserString;
}
示例2: DeleteConnectedNetworkDevice
protected function DeleteConnectedNetworkDevice()
{
$iNetworkDeviceID = $this->Get('networkdevice_id');
$iDeviceID = $this->Get('connectableci_id');
$oDevice = MetaModel::GetObject('ConnectableCI', $this->Get('connectableci_id'));
$sOQL = "SELECT lnkConnectableCIToNetworkDevice WHERE connectableci_id = :device AND networkdevice_id = :network AND network_port = :nwport AND device_port = :devport";
$oConnectionSet = new DBObjectSet(DBObjectSearch::FromOQL($sOQL), array(), array('network' => $this->Get('connectableci_id'), 'device' => $this->Get('networkdevice_id'), 'devport' => $this->Get('network_port'), 'nwport' => $this->Get('device_port')));
$iAlreadyExist = $oConnectionSet->count();
if (get_class($oDevice) == 'NetworkDevice' && $iAlreadyExist != 0) {
$oMyChange = MetaModel::NewObject("CMDBChange");
$oMyChange->Set("date", time());
if (UserRights::IsImpersonated()) {
$sUserString = Dict::Format('UI:Archive_User_OnBehalfOf_User', UserRights::GetRealUser(), UserRights::GetUser());
} else {
$sUserString = UserRights::GetUser();
}
$oMyChange->Set("userinfo", $sUserString);
$iChangeId = $oMyChange->DBInsert();
$oConnection = $oConnectionSet->Fetch();
$oConnection->DBDeleteTracked($oMyChange);
}
}