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


PHP common_session_SessionManager::startSession方法代码示例

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


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

示例1: legacy

 /**
  * Run the controller
  * 
  * @param common_http_Request $pRequest
  * @throws \ActionEnforcingException
  * @throws \Exception
  * @throws \common_exception_Error
  * @throws \common_ext_ExtensionException
  */
 public function legacy(common_http_Request $pRequest)
 {
     $resolver = new Resolver($pRequest);
     // load the responsible extension
     $ext = common_ext_ExtensionsManager::singleton()->getExtensionById($resolver->getExtensionId());
     \Context::getInstance()->setExtensionName($resolver->getExtensionId());
     // load translations
     $uiLang = \common_session_SessionManager::getSession()->getInterfaceLanguage();
     \tao_helpers_I18n::init($ext, $uiLang);
     //if the controller is a rest controller we try to authenticate the user
     $controllerClass = $resolver->getControllerClass();
     if (is_subclass_of($controllerClass, \tao_actions_RestController::class)) {
         $authAdapter = new \tao_models_classes_HttpBasicAuthAdapter(common_http_Request::currentRequest());
         try {
             $user = $authAdapter->authenticate();
             $session = new \common_session_RestSession($user);
             \common_session_SessionManager::startSession($session);
         } catch (\common_user_auth_AuthFailedException $e) {
             $data['success'] = false;
             $data['errorCode'] = '401';
             $data['errorMsg'] = 'You are not authorized to access this functionality.';
             $data['version'] = TAO_VERSION;
             header('HTTP/1.0 401 Unauthorized');
             header('WWW-Authenticate: Basic realm="' . GENERIS_INSTANCE_NAME . '"');
             echo json_encode($data);
             exit(0);
         }
     }
     try {
         $enforcer = new ActionEnforcer($resolver->getExtensionId(), $resolver->getControllerClass(), $resolver->getMethodName(), $pRequest->getParams());
         $enforcer->execute();
     } catch (InterruptedActionException $iE) {
         // Nothing to do here.
     }
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:44,代码来源:TaoFrontController.php

示例2: loadModule

 /**
  * (non-PHPdoc)
  * @see FrontController::loadModule()
  */
 public function loadModule()
 {
     $resolver = new Resolver($this->getRequest());
     // load the responsible extension
     common_ext_ExtensionsManager::singleton()->getExtensionById($resolver->getExtensionId());
     \Context::getInstance()->setExtensionName($resolver->getExtensionId());
     //if the controller is a rest controller we try to authenticate the user
     $controllerClass = $resolver->getControllerClass();
     if (is_subclass_of($controllerClass, 'tao_actions_CommonRestModule')) {
         $authAdapter = new \tao_models_classes_HttpBasicAuthAdapter(common_http_Request::currentRequest());
         try {
             $user = $authAdapter->authenticate();
             $session = new \common_session_RestSession($user);
             \common_session_SessionManager::startSession($session);
         } catch (\common_user_auth_AuthFailedException $e) {
             $class = new $controllerClass();
             $class->requireLogin();
         }
     }
     try {
         $enforcer = new ActionEnforcer($resolver->getExtensionId(), $resolver->getControllerClass(), $resolver->getMethodName(), $this->getRequest()->getParams());
         $enforcer->execute();
     } catch (InterruptedActionException $iE) {
         // Nothing to do here.
     }
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:30,代码来源:TaoFrontController.php

示例3: __construct

 public function __construct()
 {
     parent::__construct();
     $authAdapter = new tao_models_classes_HttpBasicAuthAdapter(common_http_Request::currentRequest());
     try {
         $user = $authAdapter->authenticate();
         $session = new common_session_RestSession($user);
         \common_session_SessionManager::startSession($session);
     } catch (common_user_auth_AuthFailedException $e) {
         $this->requireLogin();
     }
     /*
     	    $this->headers = tao_helpers_Http::getHeaders();
     	    $this->files = tao_helpers_Http::getFiles();
     */
     if ($this->hasHeader("Accept")) {
         try {
             $this->responseEncoding = tao_helpers_Http::acceptHeader($this->acceptedMimeTypes, $this->getHeader("Accept"));
         } catch (common_exception_ClientException $e) {
             $this->returnFailure($e);
         }
     }
     if ($this->hasHeader("Accept-Language")) {
         try {
         } catch (common_exception_ClientException $e) {
             $this->returnFailure($e);
         }
     }
     header('Content-Type: ' . $this->responseEncoding);
     //check auth method requested
     /**/
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:32,代码来源:class.CommonRestModule.php

示例4: roles

 /**
  * Action dedicated to fake roles
  */
 public function roles()
 {
     $currentSession = \common_session_SessionManager::getSession();
     if ($currentSession instanceof \common_session_RestrictedSession) {
         $this->setData('roles', $currentSession->getUserRoles());
         $this->setView('userdebug/restore.tpl');
     } else {
         $myFormContainer = new UserDebugRoles();
         $myForm = $myFormContainer->getForm();
         if ($myForm->isSubmited() && $myForm->isValid()) {
             $user = $this->userService->getCurrentUser();
             $filter = $myForm->getValue('rolefilter');
             $userUri = $myForm->getValue('user');
             if ($userUri != \common_session_SessionManager::getSession()->getUserUri()) {
                 throw new \common_exception_Error('Security exception, user to be changed is not the current user');
             }
             $session = new \common_session_RestrictedSession(\common_session_SessionManager::getSession(), $myForm->getValue('rolefilter'));
             \common_session_SessionManager::startSession($session);
             $this->setData('roles', $currentSession->getUserRoles());
             $this->setView('userdebug/restore.tpl');
         } else {
             $this->setData('formTitle', __("Restrict Roles"));
             $this->setData('myForm', $myForm->render());
             $this->setView('form.tpl', 'tao');
         }
     }
 }
开发者ID:nagyist,项目名称:extension-tao-devtools,代码行数:30,代码来源:UserDebug.php

示例5: startLtiSession

 /**
  * start a session from the provided OAuth Request
  * 
  * @param common_http_Request $request
  * @throws common_user_auth_AuthFailedException
  */
 public function startLtiSession(common_http_Request $request)
 {
     $adapter = new taoLti_models_classes_LtiAuthAdapter($request);
     $user = $adapter->authenticate();
     $session = new taoLti_models_classes_TaoLtiSession($user);
     common_session_SessionManager::startSession($session);
 }
开发者ID:nagyist,项目名称:extension-tao-lti,代码行数:13,代码来源:class.LtiService.php

示例6: login

 /**
  * action to perform authwith open_ID
  */
 public function login()
 {
     try {
         # Change 'localhost' to your domain name.
         $openid = new LightOpenID('http://e-learning-22/');
         $openid_identfier = "http://192.168.0.201:8080/Sayegh-OpenID-Provider/auth";
         if (!$openid->mode) {
             if (isset($openid_identfier)) {
                 $openid->identity = $openid_identfier;
                 # The following two lines request email, full name, and a nickname
                 # from the provider. Remove them if you don't need that data.
                 $openid->required = array('contact/email', 'namePerson');
                 $openid->optional = array("role");
                 header('Location: ' . $openid->authUrl());
                 die;
             }
             ?>
             WTF you should never reached here! XO
             <?php 
         } elseif ($openid->mode == 'cancel') {
             echo 'User has canceled authentication!';
         } else {
             $res = $openid->getAttributes();
             // [contact/email] => sara@syrianep.com [namePerson] => sara lakah
             $user = new OpenIDUser(new \core_kernel_classes_Resource("http://sep.com/" . $res['contact/email']));
             $session = new \common_session_DefaultSession($user);
             \common_session_SessionManager::startSession($session);
             $this->redirect(_url('entry', 'Main', "tao"));
             //   echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
             //  print_r($openid->getAttributes());
         }
     } catch (ErrorException $e) {
         echo $e->getMessage();
     }
 }
开发者ID:khaledvic,项目名称:oat-tao-tao-openid-auth,代码行数:38,代码来源:OpenIDLogin.php

示例7: initTest

 /**
  * shared methods for test initialization
  */
 public static function initTest()
 {
     //connect the API
     if (!self::$connected) {
         \common_session_SessionManager::startSession(new \common_test_TestUserSession());
         self::$connected = true;
     }
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:11,代码来源:TaoPhpUnitTestRunner.php

示例8: _isAllowed

 protected function _isAllowed()
 {
     $session = new taoUpdate_models_classes_Session();
     common_session_SessionManager::startSession($session);
     return true;
 }
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:6,代码来源:class.Data.php

示例9: startSession

 /**
  * Short description of method startSession
  *
  * @access public
  * @author Jerome Bogaerts, <jerome@taotesting.com>
  * @param  Resource user
  * @return boolean
  */
 public function startSession(common_user_User $user)
 {
     $session = new common_session_DefaultSession($user);
     return \common_session_SessionManager::startSession($session);
 }
开发者ID:nagyist,项目名称:generis,代码行数:13,代码来源:class.Service.php

示例10: setSession

 /**
  * Sets the current session
  * @param common_session_Session $session
  * @return boolean
  */
 public function setSession(common_session_Session $session)
 {
     return common_session_SessionManager::startSession($session);
 }
开发者ID:nagyist,项目名称:generis,代码行数:9,代码来源:class.Session.php

示例11: restoreOriginal

 /**
  * Revert back to the original Session
  */
 public function restoreOriginal()
 {
     common_session_SessionManager::startSession($this->internalSession);
 }
开发者ID:nagyist,项目名称:generis,代码行数:7,代码来源:class.RestrictedSession.php


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