限制Django-CMS中的某些页面 [英] Restrict certain pages in Django-CMS
问题描述
免责声明:我也在 Google+ ,但我不确定社区的活跃程度
Disclaimer: I asked the question also at Google+, but I'm not sure how active the community there is
我正在努力争取Django CMS的权限,但文档对我来说仍然不清楚。
我有以下要求:
I'm struggling with Django CMS' permissions, and the documentation remains unclear for me. I have the following requirements:
- 所有CMS页面仅对经过身份验证的用户可用
- 只允许工作人员进行编辑
- 某些页面只对特定组可见
我找不到实现此目标的方法。您能指出我正确的设置组合吗?
以下是一些更具体的问题:
I don't find the way to achieve this. Could you point me to the right combination of settings? Here are some more specific questions:
- 页面中的需要登录 如何权限表与您可以在页面上设置的其他权限有关?
- 如果曾经为此子项和所有子项设置了视图限制,如何删除
- 为什么
CMS_PUBLIC_FOR
没有授权用户 的值? - 是否有一种方法可以仅将所有CMS页面的访问限制为已验证的用户,而不受特定组的限制?
- How does the "Login required" in the page permissions form relate to the other permissions you can set on the page?
- If once set a view restriction for "this and all children", how can I remove it on a child page?
- Why does
CMS_PUBLIC_FOR
not have a value for "Authenticated users"? - Is there a way to just restrict viewing of all CMS pages to authenticated users without restricting by a specific group?
如果有人得到一些提示,那将是很棒的。
谢谢!
Would be great if anyone had some hints. Thanks!
推荐答案
我现在自己找到了一个解决方案:
I found a solution myself now:
首先,我编写了一个自定义中间件,该中间件将所有对Django CMS页面的请求重定向到登录名。然后,我从所有组中删除了可以查看页面的权限,并取消了编外人员的所有全局权限。
First I wrote a custom middleware that redirects all requests to Django CMS pages to the login. Then, I removed the "can view pages" permission from all groups and all global permissions for non-staff.
最后,我删除了对页面根目录的所有查看限制并设置了
Finally I removed all view restrictions on the page root and set them only on the particular pages which should be restricted.
如果您对Django CMS权限中的更多发现感兴趣:我在这里写了一些关于此的想法: http://blog.webrunners.de/2015/09/08/ django-cms-permission-pitfalls /
If you are interested about some more findings in Django CMS' permissions: I blogged some thoughts about it here: http://blog.webrunners.de/2015/09/08/django-cms-permission-pitfalls/
这篇关于限制Django-CMS中的某些页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!