本文整理汇总了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;
}
示例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;
}
示例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;
}