0
我正在使用zfc-user和ZfcRbac
的ZendFramework2进行授权和访问控制。我已经设置了一切与数据库管理角色一起工作。现在,当用户浏览到一个未经授权的网页,我收到错误页面You are not authorized to access this resource
这是由ZfcRbac
如何将未经授权的用户重定向到403页
抛出其实我在zfc-rbac.global.php
已配置重定向到403页。我的设置如下。
ZfcRbac\Exception\UnauthorizedException
-
'unauthorized_strategy' => [
'template' => 'error/403'
],
如何将用户发送到403页?
编辑
正确的答案是将UnauthorizedStrategy
附着在onBootstrap
$t = $e->getTarget();
$t->getEventManager()->attach(
$t->getServiceManager()->get('\ZfcRbac\View\Strategy\UnauthorizedStrategy')
);
确定。认为进展顺利。我用正确的事件附件更新了我的问题。 – BlueBird
403页面显示为任何内容。 403错误时如何显示整个不同的布局? – cwhisperer