Admin users can credit accounts

This commit is contained in:
Ben Arc
2022-01-31 16:29:42 +00:00
parent f5069f9699
commit dbab181759
14 changed files with 137 additions and 26 deletions
+4 -1
View File
@@ -13,7 +13,7 @@ from starlette.requests import Request
from lnbits.core.crud import get_user, get_wallet_for_key
from lnbits.core.models import User, Wallet
from lnbits.requestvars import g
from lnbits.settings import LNBITS_ALLOWED_USERS
from lnbits.settings import LNBITS_ALLOWED_USERS, LNBITS_ADMIN_USERS
class KeyChecker(SecurityBase):
@@ -204,4 +204,7 @@ async def check_user_exists(usr: UUID4) -> User:
status_code=HTTPStatus.UNAUTHORIZED, detail="User not authorized."
)
if LNBITS_ADMIN_USERS and g().user.id in LNBITS_ADMIN_USERS:
g().user.admin = True
return g().user