mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add some more context data
This commit is contained in:
parent
5c61c18dc4
commit
2460965fef
@ -35,7 +35,7 @@ class RoleDetails(APIView):
|
||||
|
||||
user = request.user
|
||||
|
||||
data = {}
|
||||
roles = {}
|
||||
|
||||
for ruleset in RuleSet.RULESET_CHOICES:
|
||||
|
||||
@ -49,9 +49,17 @@ class RoleDetails(APIView):
|
||||
permissions.append(permission)
|
||||
|
||||
if len(permissions) > 0:
|
||||
data[role] = permissions
|
||||
roles[role] = permissions
|
||||
else:
|
||||
data[role] = None
|
||||
roles[role] = None
|
||||
|
||||
data = {
|
||||
'user': user.pk,
|
||||
'username': user.username,
|
||||
'roles': roles,
|
||||
'is_staff': user.is_staff,
|
||||
'is_superuser': user.is_superuser,
|
||||
}
|
||||
|
||||
return Response(data)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user