mirror of
https://github.com/suitenumerique/people.git
synced 2026-08-17 21:25:52 +02:00
🚧(backend) return groups when requesting the resource server
Work in progress code, used during last Monday demo. I will need to iterate.
This commit is contained in:
@@ -42,4 +42,13 @@ class DataView(APIView):
|
||||
def get(self, request):
|
||||
"""Temporary route to test resource server authentication."""
|
||||
token = request.auth
|
||||
return Response(token)
|
||||
if 'groups' in token.get('scope'):
|
||||
# TODO - return a proper error
|
||||
Response({'error scope "groups" not requested to the authorization server'})
|
||||
|
||||
slugs = [team.slug for team in request.user.teams.all()]
|
||||
|
||||
# TODO - use SCIM specification to exchange data
|
||||
return Response({
|
||||
"groups": slugs
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user