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


PHP BackendUserAuthentication::modAccess方法代码示例

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


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

示例1: dispatchModule

 /**
  * Executes the modules configured via Extbase
  *
  * @param string $moduleName
  * @return Response A PSR-7 response object
  * @throws \RuntimeException
  */
 protected function dispatchModule($moduleName)
 {
     $moduleConfiguration = $this->getModuleConfiguration($moduleName);
     // Check permissions and exit if the user has no permission for entry
     $this->backendUserAuthentication->modAccess($moduleConfiguration, true);
     $id = isset($this->request->getQueryParams()['id']) ? $this->request->getQueryParams()['id'] : $this->request->getParsedBody()['id'];
     if ($id && MathUtility::canBeInterpretedAsInteger($id)) {
         // Check page access
         $permClause = $this->backendUserAuthentication->getPagePermsClause(true);
         $access = is_array(BackendUtility::readPageAccess((int) $id, $permClause));
         if (!$access) {
             throw new \RuntimeException('You don\'t have access to this page', 1289917924);
         }
     }
     /** @var Response $response */
     $response = GeneralUtility::makeInstance(Response::class);
     // Use Core Dispatching
     if (isset($moduleConfiguration['routeTarget'])) {
         $dispatcher = GeneralUtility::makeInstance(Dispatcher::class);
         $this->request = $this->request->withAttribute('target', $moduleConfiguration['routeTarget']);
         $response = $dispatcher->dispatch($this->request, $response);
     } else {
         // extbase module
         $configuration = array('extensionName' => $moduleConfiguration['extensionName'], 'pluginName' => $moduleName);
         if (isset($moduleConfiguration['vendorName'])) {
             $configuration['vendorName'] = $moduleConfiguration['vendorName'];
         }
         // Run Extbase
         $bootstrap = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class);
         $content = $bootstrap->run('', $configuration);
         $response->getBody()->write($content);
     }
     return $response;
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:41,代码来源:BackendModuleRequestHandler.php

示例2: callTraditionalModule

 /**
  * Calls traditional modules which are identified by having a index.php in their directory
  * and were previously located within the global scope.
  *
  * @param string $moduleName
  * @return bool
  */
 protected function callTraditionalModule($moduleName)
 {
     $moduleBasePath = $this->moduleRegistry['_PATHS'][$moduleName];
     $GLOBALS['MCONF'] = $moduleConfiguration = $this->getModuleConfiguration($moduleName);
     if (!empty($moduleConfiguration['access'])) {
         $this->backendUserAuthentication->modAccess($moduleConfiguration, TRUE);
     }
     if (file_exists($moduleBasePath . 'index.php')) {
         global $SOBE;
         require $moduleBasePath . 'index.php';
         return TRUE;
     }
     return FALSE;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:21,代码来源:BackendModuleRequestHandler.php

示例3: callTraditionalModule

 /**
  * Calls traditional modules which are identified by having an index.php in their directory
  * and were previously located within the global scope.
  *
  * @param string $moduleName
  * @return bool Returns TRUE if the module was executed
  */
 protected function callTraditionalModule($moduleName)
 {
     $moduleBasePath = $this->moduleRegistry['_PATHS'][$moduleName];
     // Some modules still rely on this global configuration array in a conf.php file
     // load configuration from an existing conf.php file inside the same directory
     if (file_exists($moduleBasePath . 'conf.php')) {
         require $moduleBasePath . 'conf.php';
         $moduleConfiguration = $MCONF;
     } else {
         $moduleConfiguration = $this->getModuleConfiguration($moduleName);
     }
     $GLOBALS['MCONF'] = $moduleConfiguration;
     if (!empty($moduleConfiguration['access'])) {
         $this->backendUserAuthentication->modAccess($moduleConfiguration, true);
     }
     if (file_exists($moduleBasePath . 'index.php')) {
         global $SOBE;
         require $moduleBasePath . 'index.php';
         return true;
     }
     return false;
 }
开发者ID:Gregpl,项目名称:TYPO3.CMS,代码行数:29,代码来源:BackendModuleRequestHandler.php


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