本文整理汇总了PHP中CApi::GetModuleDecorator方法的典型用法代码示例。如果您正苦于以下问题:PHP CApi::GetModuleDecorator方法的具体用法?PHP CApi::GetModuleDecorator怎么用?PHP CApi::GetModuleDecorator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CApi
的用法示例。
在下文中一共展示了CApi::GetModuleDecorator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPrincipalsByPrefix
/**
* Returns a list of principals based on a prefix.
*
* This prefix will often contain something like 'principals'. You are only
* expected to return principals that are in this base path.
*
* You are expected to return at least a 'uri' for every user, you can
* return any additional properties if you wish so. Common properties are:
* {DAV:}displayname
* {http://sabredav.org/ns}email-address - This is a custom SabreDAV
* field that's actualy injected in a number of other properties. If
* you have an email address, use this property.
*
* @param string $prefixPath
* @return array
*/
function getPrincipalsByPrefix($prefixPath)
{
$principals = [];
$aUsers = \CApi::GetModuleDecorator('Core')->GetUserList(0, 0);
if (is_array($aUsers)) {
foreach ($aUsers as $oUser) {
$principals[] = array('id' => $oUser['UUID'], 'uri' => 'principals/' . $oUser['UUID'], '{DAV:}displayname' => $oUser['Name']);
}
}
return $principals;
}
示例2: getUser
protected function getUser($principalUri)
{
if (null === $this->iUserId) {
$oCoreModuleDecorador = \CApi::GetModuleDecorator('Core');
if ($oCoreModuleDecorador) {
$oUser = $oCoreModuleDecorador->GetUser(basename($principalUri));
if ($oUser) {
$this->iUserId = basename($principalUri);
}
}
}
return $this->iUserId;
}
示例3: validateUserPass
/**
* Validates a username and password
*
* This method should return true or false depending on if login
* succeeded.
*
* @return bool
*/
protected function validateUserPass($sUserName, $sPassword)
{
$mResult = false;
if (class_exists('CApi') && \CApi::IsValid()) {
/* @var $oApiCapabilityManager \CApiCapabilityManager */
$oApiCapabilityManager = \CApi::GetSystemManager('capability');
if ($oApiCapabilityManager) {
$oDavDecorator = \CApi::GetModuleDecorator('Dav');
if ($oDavDecorator) {
$mResult = $oDavDecorator->Login($sUserName, $sPassword);
}
$bIsOutlookSyncClient = \Afterlogic\DAV\Utils::ValidateClient('outlooksync');
$bIsMobileSync = false;
$bIsOutlookSync = false;
$bIsDemo = false;
// if ($mResult !== false) {
// $iIdUser = isset($mResult['id']) ? $mResult['id'] : 0;
// return true;
/*
$bIsMobileSync = $oApiCapabilityManager->isMobileSyncSupported($iIdUser);
$bIsOutlookSync = $oApiCapabilityManager->isOutlookSyncSupported($iIdUser);
\CApi::Plugin()->RunHook(
'plugin-is-demo-account',
array(&$oAccount, &$bIsDemo)
);
*
*/
// }
/*
if (($oAccount && $oAccount->IncomingMailPassword === $sPassword &&
(($bIsMobileSync && !$bIsOutlookSyncClient) ||
($bIsOutlookSync && $bIsOutlookSyncClient))) ||
$bIsDemo || $sUserName === \CApi::ExecuteMethod('Dav::GetPublicUser')) {
return true;
}
*
*/
}
}
return $mResult;
}
示例4: getAuthenticatedUserByIdHelper
/**
* @param int $iUserId Default value is empty string.
*
* @return \CUser
*/
public function getAuthenticatedUserByIdHelper($iUserId = '')
{
$oCoreDecorator = \CApi::GetModuleDecorator('Core');
$oUser = null;
if (0 < $iUserId) {
$oUser = $oCoreDecorator->GetUser($iUserId);
} elseif ($iUserId === -1) {
$oUser = $oCoreDecorator->GetAdminUser();
}
return $oUser;
}