1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-07-17 14:55:53 +02:00
This commit is contained in:
quark
2025-07-09 15:29:50 +02:00
parent 432f50e49a
commit cf9d208586
3 changed files with 28 additions and 11 deletions

View File

@ -18,7 +18,18 @@ class PermissionScopes(BaseScopes):
and can be useful to make queries through the API with limited privileges.
"""
def get_all_scopes(self):
def get_all_scopes(self, **kwargs):
scopes = {}
if 'scopes' in kwargs:
for scope in kwargs['scopes']:
if scope == 'openid' :
scopes['openid'] = "OpenID Connect"
else:
p = Permission.objects.get(id=scope.split('_')[0])
club = Club.objects.get(id=scope.split('_')[1])
scopes[scope] = f"{p.description} (club {club.name})"
return scopes
scopes = {f"{p.id}_{club.id}": f"{p.description} (club {club.name})"
for p in Permission.objects.all() for club in Club.objects.all()}
scopes['openid'] = "OpenID Connect"