Adding more checks for write access. Adding accessRoles to Model & Knowledge creation

This commit is contained in:
tarmst
2025-01-27 18:11:52 +00:00
parent 6eb51ab62e
commit 751a61a364
6 changed files with 53 additions and 11 deletions

View File

@@ -227,7 +227,11 @@ async def delete_tools_by_id(
detail=ERROR_MESSAGES.NOT_FOUND,
)
if tools.user_id != user.id and user.role != "admin":
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_401_UNAUTHORIZED,
detail=ERROR_MESSAGES.UNAUTHORIZED,