refac: only accept own folders as the new parent when moving a folder (#34978)

Moving a folder now only accepts a parent folder the user owns.
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-25 03:01:50 +04:00
1 parent bf616b21df
commit d64df861a2
1 file changed
+6
+6
View File
@@ -534,6 +534,12 @@ async def update_folder_parent_id_by_id(
detail=ERROR_MESSAGES.DEFAULT('Folder already exists'),
)
if form_data.parent_id and not await Folders.get_folder_by_id_and_user_id(form_data.parent_id, user.id, db=db):
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail=ERROR_MESSAGES.ACCESS_PROHIBITED,
)
if form_data.parent_id and form_data.parent_id in await Folders.get_folder_ids_by_id_and_user_id_in_subtree(
id, user.id, db=db
):