File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -397,8 +397,9 @@ def import_(self, scope=ToolScope.WORKSPACE):
397397 except Exception as e :
398398 raise AppApiException (1001 , _ ("Unsupported file format" ))
399399 tool = tool_instance .tool
400+ tool_id = uuid .uuid7 ()
400401 tool_model = Tool (
401- id = uuid . uuid7 () ,
402+ id = tool_id ,
402403 name = tool .get ('name' ),
403404 desc = tool .get ('desc' ),
404405 code = tool .get ('code' ),
@@ -411,6 +412,14 @@ def import_(self, scope=ToolScope.WORKSPACE):
411412 is_active = False
412413 )
413414 tool_model .save ()
415+
416+ # 自动授权给创建者
417+ UserResourcePermissionSerializer (data = {
418+ 'workspace_id' : self .data .get ('workspace_id' ),
419+ 'user_id' : self .data .get ('user_id' ),
420+ 'auth_target_type' : AuthTargetType .TOOL .value
421+ }).auth_resource (str (tool_id ))
422+
414423 return True
415424
416425 class IconOperate (serializers .Serializer ):
You can’t perform that action at this time.
0 commit comments