Skip to content

Commit

Permalink
enterprise/rac: fix error when listing connection tokens as non-super…
Browse files Browse the repository at this point in the history
…user (cherry-pick goauthentik#10771) (goauthentik#10773)

enterprise/rac: fix error when listing connection tokens as non-superuser (goauthentik#10771)

Signed-off-by: Jens Langhammer <[email protected]>
Co-authored-by: Jens L. <[email protected]>
  • Loading branch information
gcp-cherry-pick-bot[bot] and BeryJu authored Aug 5, 2024
1 parent ad6b6e4 commit 5314485
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion authentik/enterprise/providers/rac/api/connection_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class Meta:
]


class ConnectionTokenOwnerFilter(OwnerFilter):
"""Owner filter for connection tokens (checks session's user)"""

owner_key = "session__user"


class ConnectionTokenViewSet(
mixins.RetrieveModelMixin,
mixins.UpdateModelMixin,
Expand All @@ -50,4 +56,9 @@ class ConnectionTokenViewSet(
search_fields = ["endpoint__name", "provider__name"]
ordering = ["endpoint__name", "provider__name"]
permission_classes = [OwnerSuperuserPermissions]
filter_backends = [OwnerFilter, DjangoFilterBackend, OrderingFilter, SearchFilter]
filter_backends = [
ConnectionTokenOwnerFilter,
DjangoFilterBackend,
OrderingFilter,
SearchFilter,
]

0 comments on commit 5314485

Please sign in to comment.