mirror of
https://github.com/open-webui/open-webui
synced 2025-02-01 15:24:25 +00:00
fix: tools valves access
This commit is contained in:
parent
4a2792b4da
commit
8fc5532e2f
@ -309,6 +309,17 @@ async def update_tools_valves_by_id(
|
|||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
detail=ERROR_MESSAGES.NOT_FOUND,
|
detail=ERROR_MESSAGES.NOT_FOUND,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (
|
||||||
|
tools.user_id != user.id
|
||||||
|
and not has_access(user.id, "write", tools.access_control)
|
||||||
|
and user.role != "admin"
|
||||||
|
):
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
|
detail=ERROR_MESSAGES.ACCESS_PROHIBITED,
|
||||||
|
)
|
||||||
|
|
||||||
if id in request.app.state.TOOLS:
|
if id in request.app.state.TOOLS:
|
||||||
tools_module = request.app.state.TOOLS[id]
|
tools_module = request.app.state.TOOLS[id]
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user