mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
refactor: update application setting serializer to set default favicon and improve user resource permission handling
This commit is contained in:
parent
4143d1f2c5
commit
337461b683
|
|
@ -327,11 +327,12 @@ class ModelSerializer(serializers.Serializer):
|
|||
model = Model(**model_data)
|
||||
try:
|
||||
model.save()
|
||||
UserResourcePermissionSerializer(data={
|
||||
'workspace_id': self.data.get('workspace_id'),
|
||||
'user_id': self.data.get('user_id'),
|
||||
'auth_target_type': AuthTargetType.MODEL.value
|
||||
}).auth_resource(str(model.id))
|
||||
if workspace_id != 'None':
|
||||
UserResourcePermissionSerializer(data={
|
||||
'workspace_id': workspace_id,
|
||||
'user_id': self.data.get('user_id'),
|
||||
'auth_target_type': AuthTargetType.MODEL.value
|
||||
}).auth_resource(str(model.id))
|
||||
except Exception as save_error:
|
||||
# 可添加日志记录
|
||||
raise AppApiException(500, _("Model saving failed")) from save_error
|
||||
|
|
|
|||
Loading…
Reference in New Issue