本文整理汇总了PHP中eZModule::accessAllowed方法的典型用法代码示例。如果您正苦于以下问题:PHP eZModule::accessAllowed方法的具体用法?PHP eZModule::accessAllowed怎么用?PHP eZModule::accessAllowed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZModule
的用法示例。
在下文中一共展示了eZModule::accessAllowed方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modify
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement )
{
$uri = new eZURI( $namedParameters[ 'uri' ] );
$moduleName = $uri->element( 0 );
$moduleList = eZINI::instance( 'module.ini' )->variable( 'ModuleSettings', 'ModuleList' );
if ( in_array( $moduleName, $moduleList, true ) )
$check = eZModule::accessAllowed( $uri );
$operatorValue = isset( $check['result'] ) ? $check['result'] : false;
}
示例2: exitWithInternalError
$uri = eZURI::instance(eZSys::requestURI());
$moduleName = $uri->element();
$module = eZModule::findModule($moduleName);
if (!$module instanceof eZModule) {
exitWithInternalError("'{$moduleName}' module does not exist, or is not a valid module.");
return;
}
// check existance of view
$viewName = $uri->element(1);
$moduleViews = $module->attribute('views');
if (!isset($moduleViews[$viewName])) {
exitWithInternalError("'{$viewName}' view does not exist on the current module.");
return;
}
// Check if module / view is disabled
$moduleCheck = eZModule::accessAllowed($uri);
if (!$moduleCheck['result']) {
exitWithInternalError('$moduleName/$viewName is disabled.');
}
// check access to view
$ini = eZINI::instance();
$currentUser = eZUser::currentUser();
if (!hasAccessToBySetting($moduleName, $viewName, $ini->variable('RoleSettings', 'PolicyOmitList')) && !$currentUser->hasAccessToView($module, $viewName, $params)) {
exitWithInternalError("User does not have access to the {$moduleName}/{$viewName} policy.");
return;
}
// run module view
$uri->increase();
$uri->increase();
$GLOBALS['eZRequestedModule'] = $module;
$moduleResult = $module->run($viewName, $uri->elements(false), false, $uri->userParameters());
示例3: dispatchLoop
/**
* Runs the dispatch loop
*/
protected function dispatchLoop()
{
$ini = eZINI::instance();
// Start the module loop
while ($this->siteBasics['module-run-required']) {
$objectHasMovedError = false;
$objectHasMovedURI = false;
$this->actualRequestedURI = $this->uri->uriString();
// Extract user specified parameters
$userParameters = $this->uri->userParameters();
// Generate a URI which also includes the user parameters
$this->completeRequestedURI = $this->uri->originalURIString();
// Check for URL translation
if ($this->siteBasics['url-translator-allowed'] && eZURLAliasML::urlTranslationEnabledByUri($this->uri)) {
$translateResult = eZURLAliasML::translate($this->uri);
if (!is_string($translateResult) && $ini->variable('URLTranslator', 'WildcardTranslation') === 'enabled') {
$translateResult = eZURLWildcard::translate($this->uri);
}
// Check if the URL has moved
if (is_string($translateResult)) {
$objectHasMovedURI = $translateResult;
foreach ($userParameters as $name => $value) {
$objectHasMovedURI .= '/(' . $name . ')/' . $value;
}
$objectHasMovedError = true;
}
}
if ($this->uri->isEmpty()) {
$tmp_uri = new eZURI($ini->variable("SiteSettings", "IndexPage"));
$moduleCheck = eZModule::accessAllowed($tmp_uri);
} else {
$moduleCheck = eZModule::accessAllowed($this->uri);
}
if (!$moduleCheck['result']) {
if ($ini->variable("SiteSettings", "ErrorHandler") == "defaultpage") {
$defaultPage = $ini->variable("SiteSettings", "DefaultPage");
$this->uri->setURIString($defaultPage);
$moduleCheck['result'] = true;
}
}
$displayMissingModule = false;
$this->oldURI = $this->uri;
if ($this->uri->isEmpty()) {
if (!fetchModule($tmp_uri, $this->check, $this->module, $moduleName, $functionName, $params)) {
$displayMissingModule = true;
}
} else {
if (!fetchModule($this->uri, $this->check, $this->module, $moduleName, $functionName, $params)) {
if ($ini->variable("SiteSettings", "ErrorHandler") == "defaultpage") {
$tmp_uri = new eZURI($ini->variable("SiteSettings", "DefaultPage"));
if (!fetchModule($tmp_uri, $this->check, $this->module, $moduleName, $functionName, $params)) {
$displayMissingModule = true;
}
} else {
$displayMissingModule = true;
}
}
}
if (!$displayMissingModule && $moduleCheck['result'] && $this->module instanceof eZModule) {
// Run the module/function
eZDebug::addTimingPoint("Module start '" . $this->module->attribute('name') . "'");
$moduleAccessAllowed = true;
$omitPolicyCheck = true;
$runModuleView = true;
$availableViewsInModule = $this->module->attribute('views');
if (!isset($availableViewsInModule[$functionName]) && !$objectHasMovedError && !isset($this->module->Module['function']['script'])) {
$moduleResult = $this->module->handleError(eZError::KERNEL_MODULE_VIEW_NOT_FOUND, 'kernel', array("check" => $moduleCheck));
$runModuleView = false;
$this->siteBasics['policy-check-required'] = false;
$omitPolicyCheck = true;
}
if ($this->siteBasics['policy-check-required']) {
$omitPolicyCheck = false;
$moduleName = $this->module->attribute('name');
if (in_array($moduleName, $this->siteBasics['policy-check-omit-list'])) {
$omitPolicyCheck = true;
} else {
$policyCheckViewMap = $this->getPolicyCheckViewMap($this->siteBasics['policy-check-omit-list']);
if (isset($policyCheckViewMap[$moduleName][$functionName])) {
$omitPolicyCheck = true;
}
}
}
if (!$omitPolicyCheck) {
$currentUser = eZUser::currentUser();
$siteAccessResult = $currentUser->hasAccessTo('user', 'login');
$hasAccessToSite = false;
if ($siteAccessResult['accessWord'] === 'limited') {
$policyChecked = false;
foreach (array_keys($siteAccessResult['policies']) as $key) {
$policy = $siteAccessResult['policies'][$key];
if (isset($policy['SiteAccess'])) {
$policyChecked = true;
$crc32AccessName = eZSys::ezcrc32($this->access['name']);
eZDebugSetting::writeDebug('kernel-siteaccess', $policy['SiteAccess'], $crc32AccessName);
if (in_array($crc32AccessName, $policy['SiteAccess'])) {
$hasAccessToSite = true;
//.........这里部分代码省略.........
示例4: accessAllowed
/**
* Checks if access is allowed to a module/view based on site.ini[SiteAccessRules]Rules settings
*
* @see eZModule::accessAllowed()
* @param eZURI $uri
* @return array An associative array with:
* 'result' => bool Indicates if access is allowed
* 'module' => string Module name
* 'view' => string View name
* 'view_checked' => bool Indicates if view access has been checked
*/
function accessAllowed(eZURI $uri)
{
return eZModule::accessAllowed($uri);
}
示例5: modify
function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
{
$uri = new eZURI($namedParameters['uri']);
$check = eZModule::accessAllowed($uri);
$operatorValue = $check['result'];
}
示例6: accessAllowed
/**
* Checks if access is allowed to a module/view based on site.ini[SiteAccessRules]Rules settings
*
* @see eZModule::accessAllowed()
* @deprecated Since 4.4
* @param eZURI $uri
* @return array An associative array with:
* 'result' => bool Indicates if access is allowed
* 'module' => string Module name
* 'view' => string View name
* 'view_checked' => bool Indicates if view access has been checked
*/
function accessAllowed(eZURI $uri)
{
eZDebug::writeStrict('Function accessAllowed() has been deprecated in 4.4 in favor of eZModule::accessAllowed()', 'Deprecation');
return eZModule::accessAllowed($uri);
}