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


PHP Session::isLoggedIn方法代码示例

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


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

示例1: testIsLoggedInWithIgnoredLifetime

 /**
  * Disabled form security in order to prevent exit from the app
  * @magentoConfigFixture current_store admin/security/session_lifetime 59
  */
 public function testIsLoggedInWithIgnoredLifetime()
 {
     $this->_auth->login(\Magento\TestFramework\Bootstrap::ADMIN_NAME, \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD);
     $this->assertTrue($this->_model->isLoggedIn());
     $this->_model->setUpdatedAt(time() - 101);
     $this->assertTrue($this->_model->isLoggedIn());
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:11,代码来源:SessionTest.php

示例2: match

 /**
  * Match provided request and if matched - return corresponding controller
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\Action\Action|null
  */
 public function match(\Magento\Framework\App\RequestInterface $request)
 {
     // if URL has VDE prefix
     if (!$this->_designEditorHelper->isVdeRequest($request)) {
         return null;
     }
     // user must be logged in admin area
     if (!$this->_session->isLoggedIn()) {
         return null;
     }
     // prepare request to imitate
     $this->_prepareVdeRequest($request);
     /**
      * Deprecated line of code was here which should be adopted if needed:
      * $this->_urlRewriteService->applyRewrites($request);
      */
     // match routers
     $controller = null;
     $routers = $this->_getMatchedRouters();
     /** @var $router \Magento\Framework\App\RouterInterface */
     foreach ($routers as $router) {
         /** @var $controller \Magento\Framework\App\Action\AbstractAction */
         $controller = $router->match($request);
         if ($controller) {
             $this->_state->update(\Magento\Framework\App\Area::AREA_FRONTEND, $request);
             break;
         }
     }
     // set inline translation mode
     $this->_designEditorHelper->setTranslationMode($request);
     return $controller;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:38,代码来源:Standard.php

示例3: execute

 /**
  * Predispath admin action controller
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->backendAuthSession->isLoggedIn()) {
         $feedModel = $this->feedFactory->create();
         $feedModel->checkUpdate();
     }
 }
开发者ID:swissup,项目名称:core,代码行数:13,代码来源:FetchNotifications.php

示例4: testIsLoggedIn

 /**
  * @dataProvider loginDataProvider
  */
 public function testIsLoggedIn($loggedIn)
 {
     if ($loggedIn) {
         $this->auth->login(\Magento\TestFramework\Bootstrap::ADMIN_NAME, \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD);
     }
     $this->assertEquals($loggedIn, $this->authSession->isLoggedIn());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:10,代码来源:SessionTest.php

示例5: execute

 /**
  * Predispath admin action controller
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_backendAuthSession->isLoggedIn()) {
         $feedModel = $this->_feedFactory->create();
         /* @var $feedModel \Magento\AdminNotification\Model\Feed */
         $feedModel->checkUpdate();
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:PredispatchAdminActionControllerObserver.php

示例6: execute

 /**
  * Adds New Relic custom parameters per adminhtml request for current admin user, if applicable
  *
  * @param Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function execute(Observer $observer)
 {
     if ($this->config->isNewRelicEnabled()) {
         if ($this->backendAuthSession->isLoggedIn()) {
             $user = $this->backendAuthSession->getUser();
             $this->newRelicWrapper->addCustomParameter(Config::ADMIN_USER_ID, $user->getId());
             $this->newRelicWrapper->addCustomParameter(Config::ADMIN_USER, $user->getUsername());
             $this->newRelicWrapper->addCustomParameter(Config::ADMIN_NAME, $user->getFirstname() . ' ' . $user->getLastname());
         }
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:ReportConcurrentAdminsToNewRelic.php

示例7: execute

 /**
  * Reports concurrent admins to the database reporting_users table
  *
  * @param Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function execute(Observer $observer)
 {
     if ($this->config->isNewRelicEnabled()) {
         if ($this->backendAuthSession->isLoggedIn()) {
             $user = $this->backendAuthSession->getUser();
             $jsonData = ['id' => $user->getId(), 'username' => $user->getUsername(), 'name' => $user->getFirstname() . ' ' . $user->getLastname()];
             $modelData = ['type' => 'admin_activity', 'action' => $this->jsonEncoder->encode($jsonData)];
             /** @var \Magento\NewRelicReporting\Model\Users $usersModel */
             $usersModel = $this->usersFactory->create();
             $usersModel->setData($modelData);
             $usersModel->save();
         }
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:21,代码来源:ReportConcurrentAdmins.php

示例8: execute

 /**
  * Force admin to change password
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     if (!$this->observerConfig->isPasswordChangeForced()) {
         return;
     }
     if (!$this->authSession->isLoggedIn()) {
         return;
     }
     $actionList = ['adminhtml_system_account_index', 'adminhtml_system_account_save', 'adminhtml_auth_logout'];
     /** @var \Magento\Framework\App\Action\Action $controller */
     $controller = $observer->getEvent()->getControllerAction();
     /** @var \Magento\Framework\App\RequestInterface $request */
     $request = $observer->getEvent()->getRequest();
     if ($this->authSession->getPciAdminUserIsPasswordExpired()) {
         if (!in_array($request->getFullActionName(), $actionList)) {
             if ($this->authorization->isAllowed('Magento_Backend::myaccount')) {
                 $controller->getResponse()->setRedirect($this->url->getUrl('adminhtml/system_account/'));
                 $this->actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
                 $this->actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_POST_DISPATCH, true);
             } else {
                 /*
                  * if admin password is expired and access to 'My Account' page is denied
                  * than we need to do force logout with error message
                  */
                 $this->authSession->clearStorage();
                 $this->session->clearStorage();
                 $this->messageManager->addErrorMessage(__('Your password has expired; please contact your administrator.'));
                 $controller->getRequest()->setDispatched(false);
             }
         }
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:38,代码来源:ForceAdminPasswordChangeObserver.php

示例9: testLogoutAction

 /**
  * @covers \Magento\Backend\Controller\Adminhtml\Auth::logoutAction
  * @magentoDbIsolation enabled
  */
 public function testLogoutAction()
 {
     $this->_login();
     $this->dispatch('backend/admin/auth/logout');
     $this->assertRedirect($this->equalTo(\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Backend\\Helper\\Data')->getHomePageUrl()));
     $this->assertFalse($this->_session->isLoggedIn(), 'User is not logged out.');
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:11,代码来源:AuthTest.php

示例10: testIsLoggedInPositive

 public function testIsLoggedInPositive()
 {
     $user = $this->getMock('Magento\\User\\Model\\User', ['getId', '__wakeup'], [], '', false);
     $user->expects($this->once())->method('getId')->will($this->returnValue(1));
     $this->storage->expects($this->any())->method('getUser')->will($this->returnValue($user));
     $this->assertTrue($this->session->isLoggedIn());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:7,代码来源:SessionTest.php

示例11: isLoggedIn

 /**
  * {@inheritdoc}
  */
 public function isLoggedIn()
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'isLoggedIn');
     if (!$pluginInfo) {
         return parent::isLoggedIn();
     } else {
         return $this->___callPlugins('isLoggedIn', func_get_args(), $pluginInfo);
     }
 }
开发者ID:dragonsword007008,项目名称:magento2,代码行数:12,代码来源:Interceptor.php

示例12: isBackendOrder

 protected function isBackendOrder()
 {
     return $this->backendAuthSession->isLoggedIn();
 }
开发者ID:owebia,项目名称:magento2-module-advanced-setting-core,代码行数:4,代码来源:AbstractWrapper.php


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