Skip to content

Commit

Permalink
💚 #554 - chore: fix broken CI check possibly due to missing permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvandescheur committed Dec 20, 2024
1 parent 55f61ec commit 7b7734f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/src/openarchiefbeheer/accounts/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ def record_managers(self) -> "UserQuerySet":
"""
Returns a QuerySet of users that have the permission to start a destruction list.
"""
permission = Permission.objects.get(codename="can_start_destruction")
# Rare occasion where permissions are not yet available causes a crash when using get. Use filter instead.
permissions = Permission.objects.filter(codename="can_start_destruction")
permission = permissions[0] if permissions.exists() else None
return self._users_with_permission(permission)

def reviewers(self) -> "UserQuerySet":
Expand Down

0 comments on commit 7b7734f

Please sign in to comment.