Fix collections API showing unapproved packages

Fixes #504
This commit is contained in:
rubenwardy
2024-03-30 17:46:54 +00:00
parent e82dac4403
commit f0a33927bd
2 changed files with 8 additions and 5 deletions

View File

@@ -95,7 +95,7 @@ class Collection(db.Model):
elif type(perm) != Permission:
raise Exception("Unknown permission given to Collection.check_perm()")
if not user.is_authenticated:
if user is None or not user.is_authenticated:
return perm == Permission.VIEW_COLLECTION and not self.private
can_view = not self.private or self.author == user or user.rank.at_least(UserRank.MODERATOR)