Skip to content

Commit

Permalink
Fix code that assumes AnonymousUser has is_crew
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanw committed Nov 19, 2024
1 parent 484ca10 commit b2d012d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion froide/document/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def filter_foirequest(self, qs, name, value):


def get_portal_queryset(request):
if not request.user.is_crew:
if not request.user.is_authenticated or not request.user.is_crew:
return DocumentPortal.objects.filter(public=True)
return DocumentPortal.objects.all()

Expand Down
2 changes: 1 addition & 1 deletion froide/helper/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def get_user_filter(request, teams=None, fk_path=None):

def require_crew(view_func):
def decorator(request, *args, **kwargs):
if not request.user.is_crew:
if not request.user.is_authenticated or not request.user.is_crew:
raise PermissionDenied
return view_func(request, *args, **kwargs)

Expand Down

0 comments on commit b2d012d

Please sign in to comment.