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


PHP CApi::getAuthenticatedUserId方法代码示例

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


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

示例1: getAuthenticatedUser

 public static function getAuthenticatedUser($iUserId = '')
 {
     static $oUser = null;
     if ($oUser === null) {
         if (!empty($iUserId)) {
             \CApi::getAuthenticatedUserId($iUserId);
             // called for saving in session
         } else {
             if (!empty(self::$aUserSession['UserId'])) {
                 $iUserId = self::$aUserSession['UserId'];
             }
         }
         $oApiIntegrator = \CApi::GetSystemManager('integrator');
         if ($oApiIntegrator) {
             $oUser = $oApiIntegrator->getAuthenticatedUserByIdHelper($iUserId);
         }
     }
     return $oUser;
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:19,代码来源:api.php

示例2: getAuthenticatedDefaultAccount

 /**
  * @return CAccount|null
  */
 public function getAuthenticatedDefaultAccount($sAuthToken = '')
 {
     $oResult = null;
     $iUserId = \CApi::getAuthenticatedUserId($sAuthToken);
     if (0 < $iUserId) {
         $oApiUsers = CApi::GetSystemManager('users');
         if ($oApiUsers) {
             $iAccountId = $oApiUsers->getDefaultAccountId($iUserId);
             if (0 < $iAccountId) {
                 $oAccount = $oApiUsers->getAccountById($iAccountId);
                 $oResult = $oAccount instanceof \CAccount ? $oAccount : null;
             }
         }
     } else {
         $this->logoutAccount();
     }
     return $oResult;
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:21,代码来源:manager.php

示例3: CallMethod

 /**
  * 
  * @param string $sMethod
  * @param array $aArguments
  * @param boolean $bWebApi
  * @return mixed
  */
 public function CallMethod($sMethod, $aArguments = array(), $bWebApi = false)
 {
     $mResult = false;
     try {
         if (method_exists($this, $sMethod) && !($bWebApi && $this->isCallbackMethod($sMethod))) {
             if ($bWebApi && !isset($aArguments['UserId'])) {
                 $aArguments['UserId'] = \CApi::getAuthenticatedUserId();
             }
             // prepare arguments for before event
             $aMethodArgs = $this->prepareMethodArguments($sMethod, $aArguments, $bWebApi);
             $bEventResult = $this->broadcastEvent($sMethod . \AApiModule::$Delimiter . 'before', $aArguments, $mResult);
             // prepare arguments for main action after event
             $aMethodArgs = $this->prepareMethodArguments($sMethod, $aArguments, $bWebApi);
             if (!$bEventResult) {
                 try {
                     $mMethodResult = call_user_func_array(array($this, $sMethod), $aMethodArgs);
                     if (is_array($mMethodResult) && is_array($mResult)) {
                         $mResult = array_merge($mMethodResult, $mResult);
                     } else {
                         if ($mMethodResult !== null) {
                             $mResult = $mMethodResult;
                         }
                     }
                 } catch (\Exception $oException) {
                     \CApi::GetModuleManager()->AddResult($this->GetName(), $sMethod, $mResult, $oException->getCode());
                     if (!$oException instanceof \System\Exceptions\AuroraApiException) {
                         throw new \System\Exceptions\AuroraApiException($oException->getCode(), $oException, $oException->getMessage());
                     } else {
                         throw $oException;
                     }
                 }
             }
             $this->broadcastEvent($sMethod . \AApiModule::$Delimiter . 'after', $aArguments, $mResult);
             \CApi::GetModuleManager()->AddResult($this->GetName(), $sMethod, $mResult);
         }
     } catch (\Exception $oException) {
         if (!$oException instanceof \System\Exceptions\AuroraApiException) {
             throw new \System\Exceptions\AuroraApiException($oException->getCode(), $oException, $oException->getMessage());
         } else {
             throw $oException;
         }
     }
     return $mResult;
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:51,代码来源:module.php

示例4: GetDefaultAccount

 /**
  * @return \CAccount | null
  */
 public static function GetDefaultAccount()
 {
     $oResult = null;
     $oApiUsers = \CApi::GetSystemManager('users');
     $oApiIntegrator = \CApi::GetSystemManager('integrator');
     $iUserId = \CApi::getAuthenticatedUserId();
     if (0 < $iUserId) {
         $iAccountId = $oApiUsers->getDefaultAccountId($iUserId);
         if (0 < $iAccountId) {
             $oAccount = $oApiUsers->getAccountById($iAccountId);
             if ($oAccount instanceof \CAccount && !$oAccount->IsDisabled) {
                 $oResult = $oAccount;
             }
         }
     }
     return $oResult;
 }
开发者ID:afterlogic,项目名称:aurora-core,代码行数:20,代码来源:utils.php


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