core: fix users's system_permissions not including role permissions

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer
2024-01-18 22:28:11 +01:00
parent fd7572e699
commit c6d1ed2a71

View File

@ -227,9 +227,9 @@ class UserSelfSerializer(ModelSerializer):
def get_system_permissions(self, user: User) -> list[str]: def get_system_permissions(self, user: User) -> list[str]:
"""Get all system permissions assigned to the user""" """Get all system permissions assigned to the user"""
return list( return list(
user.user_permissions.filter( x.split(".", maxsplit=1)[1]
content_type__app_label="authentik_rbac", content_type__model="systempermission" for x in user.get_all_permissions()
).values_list("codename", flat=True) if x.startswith("authentik_rbac")
) )
class Meta: class Meta: