mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 12:49:29 +02:00
Initial commit that merge both the front end and the API in the same repository
This commit is contained in:
commit
76f98b74dd
285 changed files with 51318 additions and 0 deletions
29
api/funkwhale_api/users/serializers.py
Normal file
29
api/funkwhale_api/users/serializers.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from . import models
|
||||
|
||||
|
||||
class UserSerializer(serializers.ModelSerializer):
|
||||
|
||||
permissions = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = models.User
|
||||
fields = [
|
||||
'id',
|
||||
'username',
|
||||
'name',
|
||||
'email',
|
||||
'is_staff',
|
||||
'is_superuser',
|
||||
'permissions',
|
||||
'date_joined',
|
||||
]
|
||||
|
||||
def get_permissions(self, o):
|
||||
perms = {}
|
||||
for internal_codename, conf in o.relevant_permissions.items():
|
||||
perms[conf['external_codename']] = {
|
||||
'status': o.has_perm(internal_codename)
|
||||
}
|
||||
return perms
|
Loading…
Add table
Add a link
Reference in a new issue