本文整理汇总了PHP中UserRights::GetRealUser方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRights::GetRealUser方法的具体用法?PHP UserRights::GetRealUser怎么用?PHP UserRights::GetRealUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRights
的用法示例。
在下文中一共展示了UserRights::GetRealUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DoExecute
protected function DoExecute()
{
$sUser = 'Romain';
echo "<p>Totor: " . (UserRights::CheckCredentials('Totor', 'toto') ? 'ok' : 'NO') . "</p>\n";
echo "<p>Romain: " . (UserRights::CheckCredentials('Romain', 'toto') ? 'ok' : 'NO') . "</p>\n";
echo "<p>User: " . UserRights::GetUser() . "</p>\n";
echo "<p>On behalf of..." . UserRights::GetRealUser() . "</p>\n";
echo "<p>Denis (impersonate) : " . (UserRights::Impersonate('Denis', 'tutu') ? 'ok' : 'NO') . "</p>\n";
echo "<p>User: " . UserRights::GetUser() . "</p>\n";
echo "<p>On behalf of..." . UserRights::GetRealUser() . "</p>\n";
$oSet = new DBObjectSet(DBObjectSearch::FromOQL("SELECT bizOrganization"));
echo "<p>IsActionAllowed..." . (UserRights::IsActionAllowed('bizOrganization', UR_ACTION_MODIFY, $oSet) == UR_ALLOWED_YES ? 'ok' : 'NO') . "</p>\n";
echo "<p>IsStimulusAllowed..." . (UserRights::IsStimulusAllowed('bizOrganization', 'myStimulus', $oSet) == UR_ALLOWED_YES ? 'ok' : 'NO') . "</p>\n";
echo "<p>IsActionAllowedOnAttribute..." . (UserRights::IsActionAllowedOnAttribute('bizOrganization', 'myattribute', UR_ACTION_MODIFY, $oSet) == UR_ALLOWED_YES ? 'ok' : 'NO') . "</p>\n";
return true;
}
示例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);
}
}