feat: prevent all changes to the default user in demo (#2470)

This commit is contained in:
Michael Genson
2023-07-29 16:39:49 -05:00
committed by GitHub
parent a75116bc62
commit e434029bac
2 changed files with 28 additions and 0 deletions

View File

@@ -113,6 +113,10 @@ class UserOut(UserBase):
getter_dict = UserGetterDict
@property
def is_default_user(self) -> bool:
return self.email == settings.DEFAULT_EMAIL.strip().lower()
@classmethod
def loader_options(cls) -> list[LoaderOption]:
return [joinedload(User.group), joinedload(User.favorite_recipes), joinedload(User.tokens)]