allow members to see groups and their lists
- add additional logic to visible_to_user, for groups and their objects - cleans up some queries in Group view NOTE: I can't work out how to make group lists only visible to users who should be able to see them, on user group listings. They still can't access the actual group, but can see it on user pages. This is potentialy problematic.
This commit is contained in:
parent
df5a5f94a1
commit
1a02af1450
2 changed files with 15 additions and 11 deletions
|
@ -77,8 +77,17 @@ class BookWyrmModel(models.Model):
|
|||
):
|
||||
return True
|
||||
|
||||
# TODO: if privacy is direct and the object is a group and viewer is a member of the group
|
||||
# then return True
|
||||
# you can see groups of which you are a member
|
||||
if hasattr(self, "members") and viewer in self.members.all():
|
||||
return True
|
||||
|
||||
# you can see objects which have a group of which you are a member
|
||||
if hasattr(self, "group"):
|
||||
if (
|
||||
hasattr(self.group, "members")
|
||||
and viewer in self.group.members.all()
|
||||
):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue