feat: auto-propose events from non-admin users
Some checks failed
lint.yml / feat: auto-propose events from non-admin users (pull_request) Failing after 0s
Some checks failed
lint.yml / feat: auto-propose events from non-admin users (pull_request) Failing after 0s
Events created by non-admin users via POST /events are now set to 'proposed' status, requiring LNbits admin approval. Admin-created events are auto-approved. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ba97205592
commit
920125aaee
1 changed files with 10 additions and 0 deletions
10
views_api.py
10
views_api.py
|
|
@ -99,6 +99,16 @@ async def api_event_create(
|
||||||
else:
|
else:
|
||||||
if not data.wallet:
|
if not data.wallet:
|
||||||
data.wallet = wallet.wallet.id
|
data.wallet = wallet.wallet.id
|
||||||
|
# Auto-approve for LNbits admins, require approval for regular users
|
||||||
|
from lnbits.settings import settings
|
||||||
|
|
||||||
|
user_id = wallet.wallet.user
|
||||||
|
is_admin = (
|
||||||
|
user_id == settings.super_user
|
||||||
|
or user_id in settings.lnbits_admin_users
|
||||||
|
)
|
||||||
|
if not is_admin:
|
||||||
|
data.status = "proposed"
|
||||||
event = await create_event(data)
|
event = await create_event(data)
|
||||||
|
|
||||||
return event.dict()
|
return event.dict()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue