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:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user