本文整理匯總了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;
}