fix: 修复 supertoken 创建

pull/9158/head
ibuler 2 years ago
parent ca228074e3
commit 80e550b71a

@ -31,18 +31,15 @@ class ConnectionTokenSerializer(OrgResourceModelSerializerMixin):
'value': {'read_only': True},
}
def get_request_user(self):
def get_user(self, attrs):
request = self.context.get('request')
user = request.user if request else None
return user
def get_user(self, attrs):
return self.get_request_user()
class SuperConnectionTokenSerializer(ConnectionTokenSerializer):
class Meta(ConnectionTokenSerializer.Meta):
pass
read_only_fields = list(set(ConnectionTokenSerializer.Meta.read_only_fields) - {'user'})
def get_user(self, attrs):
return attrs.get('user') or self.get_request_user()
return attrs.get('user')

Loading…
Cancel
Save