Implement variant of dep injections to get active/super user

This commit is contained in:
François Voron
2019-10-11 08:09:47 +02:00
parent ef796abb55
commit 76bb7bf6a5
8 changed files with 330 additions and 42 deletions

View File

@ -34,5 +34,11 @@ class FastAPIUsers:
self.auth = auth
self.router = get_user_router(self.db, user_model, self.auth)
get_current_user = self.auth.get_authentication_method(self.db)
get_current_user = self.auth.get_current_user(self.db)
self.get_current_user = get_current_user # type: ignore
get_current_active_user = self.auth.get_current_active_user(self.db)
self.get_current_active_user = get_current_active_user # type: ignore
get_current_superuser = self.auth.get_current_superuser(self.db)
self.get_current_superuser = get_current_superuser # type: ignore