当前位置: 首页>>代码示例>>PHP>>正文


PHP CApi::getAuthenticatedUser方法代码示例

本文整理汇总了PHP中CApi::getAuthenticatedUser方法的典型用法代码示例。如果您正苦于以下问题:PHP CApi::getAuthenticatedUser方法的具体用法?PHP CApi::getAuthenticatedUser怎么用?PHP CApi::getAuthenticatedUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CApi的用法示例。


在下文中一共展示了CApi::getAuthenticatedUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkUserRoleIsAtLeast

 /**
  * Checks if authenticated user has at least specified role.
  * @param int $iRole
  * @throws \System\Exceptions\AuroraApiException
  */
 public static function checkUserRoleIsAtLeast($iRole)
 {
     $oUser = \CApi::getAuthenticatedUser();
     $bUserRoleIsAtLeast = empty($oUser) && $iRole === \EUserRole::Anonymous || !empty($oUser) && $oUser->Role === \EUserRole::Customer && ($iRole === \EUserRole::Customer || $iRole === \EUserRole::Anonymous) || !empty($oUser) && $oUser->Role === \EUserRole::NormalUser && ($iRole === \EUserRole::NormalUser || $iRole === \EUserRole::Customer || $iRole === \EUserRole::Anonymous) || !empty($oUser) && $oUser->Role === \EUserRole::TenantAdmin && ($iRole === \EUserRole::TenantAdmin || $iRole === \EUserRole::NormalUser || $iRole === \EUserRole::Customer || $iRole === \EUserRole::Anonymous) || !empty($oUser) && $oUser->Role === \EUserRole::SuperAdmin && ($iRole === \EUserRole::SuperAdmin || $iRole === \EUserRole::TenantAdmin || $iRole === \EUserRole::NormalUser || $iRole === \EUserRole::Customer || $iRole === \EUserRole::Anonymous);
     if (!$bUserRoleIsAtLeast) {
         throw new \System\Exceptions\AuroraApiException(\System\Notifications::AccessDenied);
     }
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:13,代码来源:api.php

示例2: getThemeAndLanguage

 /**
  * @return array
  */
 public function getThemeAndLanguage()
 {
     static $sLanguage = false;
     static $sTheme = false;
     static $sSiteName = false;
     if (false === $sLanguage && false === $sTheme && false === $sSiteName) {
         $oSettings =& CApi::GetSettings();
         $sSiteName = $oSettings->GetConf('SiteName');
         $sLanguage = $oSettings->GetConf('DefaultLanguage');
         $sTheme = $oSettings->GetConf('DefaultSkin');
         $oUser = \CApi::getAuthenticatedUser();
         if ($oUser) {
             $sSiteName = '';
         } else {
         }
         $sLanguage = $this->validatedLanguageValue($sLanguage);
         $this->setLoginLanguage($sLanguage);
         // todo: sash
         $sTheme = $this->validatedThemeValue($sTheme);
     }
     /*** temporary fix to the problems in mobile version in rtl mode ***/
     /* @var $oApiCapability \CApiCapabilityManager */
     $oApiCapability = \CApi::GetSystemManager('capability');
     if (in_array($sLanguage, array('Arabic', 'Hebrew', 'Persian')) && $oApiCapability && $oApiCapability->isNotLite() && 1 === $this->isMobile()) {
         $sLanguage = 'English';
     }
     /*** end of temporary fix to the problems in mobile version in rtl mode ***/
     return array($sLanguage, $sTheme, $sSiteName);
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:32,代码来源:manager.php


注:本文中的CApi::getAuthenticatedUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。