mirror of
https://github.com/lnbits/lnbits.git
synced 2025-06-29 10:10:00 +02:00
fix disapearing admin extension
This commit is contained in:
@ -1,15 +1,15 @@
|
|||||||
import json
|
|
||||||
import datetime
|
import datetime
|
||||||
from uuid import uuid4
|
import json
|
||||||
from typing import List, Optional, Dict, Any
|
from typing import Any, Dict, List, Optional
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
from uuid import uuid4
|
||||||
|
|
||||||
from lnbits import bolt11
|
from lnbits import bolt11
|
||||||
from lnbits.db import Connection, POSTGRES, COCKROACH
|
from lnbits.db import COCKROACH, POSTGRES, Connection
|
||||||
from lnbits.settings import DEFAULT_WALLET_NAME
|
from lnbits.settings import DEFAULT_WALLET_NAME, LNBITS_ADMIN_USERS
|
||||||
|
|
||||||
from . import db
|
from . import db
|
||||||
from .models import User, Wallet, Payment, BalanceCheck
|
from .models import BalanceCheck, Payment, User, Wallet
|
||||||
|
|
||||||
# accounts
|
# accounts
|
||||||
# --------
|
# --------
|
||||||
@ -53,6 +53,7 @@ async def get_user(user_id: str, conn: Optional[Connection] = None) -> Optional[
|
|||||||
""",
|
""",
|
||||||
(user_id,),
|
(user_id,),
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ async def get_user(user_id: str, conn: Optional[Connection] = None) -> Optional[
|
|||||||
email=user["email"],
|
email=user["email"],
|
||||||
extensions=[e[0] for e in extensions],
|
extensions=[e[0] for e in extensions],
|
||||||
wallets=[Wallet(**w) for w in wallets],
|
wallets=[Wallet(**w) for w in wallets],
|
||||||
|
admin=LNBITS_ADMIN_USERS and user["id"] in LNBITS_ADMIN_USERS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ from lnbits.core.models import User
|
|||||||
from lnbits.decorators import check_user_exists
|
from lnbits.decorators import check_user_exists
|
||||||
from lnbits.helpers import template_renderer, url_for
|
from lnbits.helpers import template_renderer, url_for
|
||||||
from lnbits.settings import (
|
from lnbits.settings import (
|
||||||
LNBITS_ALLOWED_USERS,
|
|
||||||
LNBITS_ADMIN_USERS,
|
LNBITS_ADMIN_USERS,
|
||||||
|
LNBITS_ALLOWED_USERS,
|
||||||
LNBITS_SITE_TITLE,
|
LNBITS_SITE_TITLE,
|
||||||
SERVICE_FEE,
|
SERVICE_FEE,
|
||||||
)
|
)
|
||||||
@ -118,8 +118,6 @@ async def wallet(
|
|||||||
return template_renderer().TemplateResponse(
|
return template_renderer().TemplateResponse(
|
||||||
"error.html", {"request": request, "err": "User not authorized."}
|
"error.html", {"request": request, "err": "User not authorized."}
|
||||||
)
|
)
|
||||||
if LNBITS_ADMIN_USERS and user_id in LNBITS_ADMIN_USERS:
|
|
||||||
user.admin = True
|
|
||||||
if not wallet_id:
|
if not wallet_id:
|
||||||
if user.wallets and not wallet_name:
|
if user.wallets and not wallet_name:
|
||||||
wallet = user.wallets[0]
|
wallet = user.wallets[0]
|
||||||
|
Reference in New Issue
Block a user