[英]How to change user's permissions under django?
I am working on Geonode and when I add a new layer, people who are not logged in are not suppose to see the layers but I would like to change it and allow it to everyone. 我正在使用Geonode,当我添加一个新图层时,未登录的人员不会看到这些图层,但是我想对其进行更改并允许所有人使用。 I saw on an old forum that it was possible by changing the SKIP_PERMS_FILTER in a file and the read_list too, but I am not use to django and I don't know what to change.
我在一个旧论坛上看到,可以通过更改文件和read_list中的SKIP_PERMS_FILTER来实现,但是我不习惯使用django,也不知道要更改什么。
SKIP_PERMS_FILTER = strtobool(os.getenv('SKIP_PERMS_FILTER', 'False'))
def read_list(self, object_list, bundle):
permitted_ids = get_objects_for_user(
bundle.request.user,
'base.view_resourcebase').values('id')
return object_list.filter(id__in=permitted_ids)
为了解决该问题,只需删除假定要打印图层的函数之前的代码中的{% if user.is_authenticated %}
语句。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.