CakePHP:ACL 误报 authError
我已经在公司现有站点内使用 CakePHP 建立了一个有效的 ACL 系统。访问限制非常有效,无权访问网站特定部分的组和单个用户会收到一条 authError 消息,说明他们没有适当的权限。
唯一的问题是,在 Firefox 中我有时会收到(我想称之为)误报。这意味着,即使用户有权访问某个控制器和操作,仍然会弹出 authError。奇怪的是,视图仍然正确呈现,除了 authError 之外没有任何问题。一切正常,用户可以看到他们需要看到的内容。仅有时仍显示 authError。
现在,这种情况在 Firefox 中有时会随机发生,但在 IE8 中这种情况一直发生。即使用户拥有整个站点的完全访问权限,IE8 中的每个页面上仍然会显示 authError 消息。我还没有检查这个问题在其他 IE 浏览器中是否仍然存在,但由于它在 IE8 和 FF 中都发生,我的想法是它们可能也存在于其他浏览器中。
现在我无法理解为什么会发生这种情况,因为这里没有真正的模式。在 FF 中,authError 会随机给出误报,而在 IE8 中,它只是一直显示。
有人可能会争辩说,出于某种原因,在 authError 消息“出现”后会检查用户权限。即使已经显示错误消息,也能正确访问。我已经检查过页面的加载时间是否与此有关,但情况似乎并非如此。
周围的用户是否知道导致此问题的原因是什么?提前致谢!
I have set up a working ACL system with CakePHP inside my company's existing site. Access restriction works perfect, groups and single users that don't have the right to visit a specific portion of the site get an authError message explaining that they don't have the proper rights.
The only problem is that in Firefox I sometimes get -what I'd like to call- false positives. This means that, even though a user has access to a certain controller and action, the authError still pops up. The strange thing is, the view still renders properly, and except for the authError there is nothing wrong. Everything works, users can see what they need to see. Only sometimes the authError is still displayed.
Now this randomly occurs sometimes in Firefox, but in IE8 this happens all the time. Even though a user has full access to the whole site, the authError message is still displayed on every single page in IE8. I haven't checked if this problem persists in other IE browsers, but since it happens in both IE8 and FF, my thoughts were that they probably exist in others too.
Now I can't get my head around why this is happening, since there is no real pattern here. In FF the authError randomly gives a false positive, and in IE8 it is just displayed all the time.
One could argue that for some reason the users rights are checked after the authError message has been given a 'go' to appear. Resulting in proper access even though the error message has already been displayed. I already checked whether or not the loading time of the page had anything to do with it, but this does not seem to be the case.
Are there users around that have any idea what could be the cause of this problem? Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不完全确定为什么会发生这种情况,也不知道您是否能够解决您的问题。然而,我也在运行 ACL 并遇到了类似的问题,我想将其发布在这里并希望对某人有所帮助。
我有一个文章控制器,我需要将
index
和view
操作公开。无论我做什么,都没有效果。我仍然会收到相同的未授权错误
。经过许多个不眠之夜的尝试和尝试,我发现,虽然我正在请求view
操作,但视图操作中引用的任何其他操作,例如getRelated<还必须添加 /code> 或
getComments
。问题已经解决了,至少我是这么认为的。然而,间歇性地,错误会一次又一次地弹出。同样的问题,同样的错误。现在,我能够访问“查看”操作,但不能访问“索引”,尽管
$this->Auth->allow
看起来一切都很好。经过多次绞尽脑汁后,我发现我必须对我的类别控制器做同样的事情。在此控制器中,我创建了一个
getRelated
操作,该操作将根据其类别检索与特定文章相关的所有文章。一旦我这样做了,现在我所有的问题都消失了,而且我没有遇到类似的问题。现在我实际上可以专注于项目的其他部分。
I am not entirely sure why that happens and I dont know if you were able to figure out your issue. However, I am also running ACL and had a similar issue and figure I would post it here and hopefully help someone.
I had an Articles controller that I needed the
index
andview
actions to be public. No matter what I did, nothing worked. I would still get the samenot authorized error
. After many sleepless nights of trying and trying, I came to find out that, although I am requesting theview
action for example, any other actions that are referenced in the view action, likegetRelated
orgetComments
would have to be added as well.The issue was fixed, or so I thought. However, intermittently, the error would pop up again and again. Same issue, same error. Now, I was able to access the View action but not the Index, although everything seemed good with the
$this->Auth->allow
After many more head scratching, I came to find out that I had to do the same with my Categories Controller. In this controller I had created a
getRelated
action that would retrieve all Articles related to a specific article based on its category.As soon as I did that, now all my problems went away and I have not experience a similar issue. Now I can actually concentrate into other sections of my project.