Skip to content

Commit

Permalink
feat: 更新自定义工具时加上权限判断
Browse files Browse the repository at this point in the history
  • Loading branch information
zgqgit committed Jun 26, 2024
1 parent bec4488 commit 8bb50c7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/backend/bisheng/api/services/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@ def update_gpts_tools(cls, user: UserPayload, req: GptsToolsTypeRead) -> Unified
tool_type = GptsToolsDao.get_one_tool_type_by_name(user.user_id, req.name)
if tool_type and tool_type.id != exist_tool_type.id:
return ToolTypeRepeatError.return_resp()
# 判断是否有更新权限
if not user.access_check(exist_tool_type.user_id, exist_tool_type.id, AccessType.GPTS_TOOL_WRITE):
return UnAuthorizedError.return_resp()

exist_tool_type.name = req.name
exist_tool_type.logo = req.logo
Expand Down

0 comments on commit 8bb50c7

Please sign in to comment.