Skip to content

Commit 0c89f4a

Browse files
Restrict advert picture addition to managers of the advertiser (#789)
### Description Please explain the changes you made here. ### Checklist - [ ] Created tests which fail without the change (if possible) - [ ] All tests passing - [ ] Extended the documentation, if necessary
1 parent 1de9053 commit 0c89f4a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/modules/advert/endpoints_advert.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,15 @@ async def create_advert_image(
423423
detail="The advert does not exist",
424424
)
425425

426+
if not is_user_member_of_any_group(
427+
user,
428+
[GroupType.admin, advert.advertiser.group_manager_id],
429+
):
430+
raise HTTPException(
431+
status_code=403,
432+
detail=f"Unauthorized to manage {advert.advertiser.name} adverts",
433+
)
434+
426435
await save_file_as_data(
427436
upload_file=image,
428437
directory="adverts",

0 commit comments

Comments
 (0)