How to check what permission failed in authorization in pyramid (pylons 2)?

自闭症网瘾萝莉.ら 提交于 2020-01-02 13:26:17

问题


I add a view for the forbidden view:

from pyramid.exceptions import Forbidden
config.add_view(forbidden_view, context=Forbidden)

which redirects to a log in screen.

But now i added some admin things which needed admin access, and I want to just show a "you don't have the permission" screen, how do I check for that in the forbidden view?


回答1:


I'm afraid that information is lost when Pyramid raises a Forbidden error as the result of a permission denial. There's an item in the TODO.txt to carry it along through the Forbidden error.



来源:https://stackoverflow.com/questions/4916149/how-to-check-what-permission-failed-in-authorization-in-pyramid-pylons-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!