Skip to content

Commit

Permalink
Allow authorized user to view public images of another user
Browse files Browse the repository at this point in the history
  • Loading branch information
derneuere committed May 18, 2024
1 parent bdb4fea commit 41083f7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/views/albums.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ def get_queryset(self):
photoFilter = []
photoFilter.append(Q(aspect_ratio__isnull=False))

if not self.request.user.is_anonymous:
if not self.request.user.is_anonymous and not self.request.query_params.get(
"public"
):
photoFilter.append(Q(owner=self.request.user))
if self.request.query_params.get("favorite"):
min_rating = self.request.user.favorite_min_rating
Expand Down Expand Up @@ -443,7 +445,9 @@ def get_queryset(self):
else:
filter.append(Q(photos__deleted=False))

if not self.request.user.is_anonymous:
if not self.request.user.is_anonymous and not self.request.query_params.get(
"public"
):
filter.append(Q(owner=self.request.user))
filter.append(Q(photos__owner=self.request.user))

Expand Down

0 comments on commit 41083f7

Please sign in to comment.