mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 09:49:23 +02:00
Resolve "Implement a Oauth provider in Funkwhale"
This commit is contained in:
parent
1dc7304bd3
commit
4c13d47387
54 changed files with 2811 additions and 249 deletions
29
api/funkwhale_api/users/oauth/serializers.py
Normal file
29
api/funkwhale_api/users/oauth/serializers.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from .. import models
|
||||
|
||||
|
||||
class ApplicationSerializer(serializers.ModelSerializer):
|
||||
scopes = serializers.CharField(source="scope")
|
||||
|
||||
class Meta:
|
||||
model = models.Application
|
||||
fields = ["client_id", "name", "scopes", "created", "updated"]
|
||||
|
||||
|
||||
class CreateApplicationSerializer(serializers.ModelSerializer):
|
||||
name = serializers.CharField(required=True, max_length=255)
|
||||
scopes = serializers.CharField(source="scope", default="read")
|
||||
|
||||
class Meta:
|
||||
model = models.Application
|
||||
fields = [
|
||||
"client_id",
|
||||
"name",
|
||||
"scopes",
|
||||
"client_secret",
|
||||
"created",
|
||||
"updated",
|
||||
"redirect_uris",
|
||||
]
|
||||
read_only_fields = ["client_id", "client_secret", "created", "updated"]
|
Loading…
Add table
Add a link
Reference in a new issue