mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-01-16 22:11:21 -05:00
* add proper type annotations * fix state management and dead code * add response messages
11 lines
368 B
Python
11 lines
368 B
Python
from fastapi import HTTPException, status
|
|
from pydantic import UUID4
|
|
|
|
from mealie.schema.user.user import PrivateUser
|
|
|
|
|
|
def assert_user_change_allowed(id: UUID4, current_user: PrivateUser):
|
|
if current_user.id != id and not current_user.admin:
|
|
# only admins can edit other users
|
|
raise HTTPException(status.HTTP_403_FORBIDDEN, detail="NOT_AN_ADMIN")
|