feat: admin user management API, multi-admin roles, and conditional bootstrap login #2

Merged
robot merged 9 commits from feature/multi-admin-roles into main 2026-07-31 14:24:16 -07:00
Showing only changes of commit 433bdef5d0 - Show all commits
-20
View File
@@ -178,26 +178,6 @@ async def lifespan(app: FastAPI):
except Exception as e: except Exception as e:
print(f" WARNING: Failed to write theme.json on startup: {e}") print(f" WARNING: Failed to write theme.json on startup: {e}")
# Bootstrap admin user if configured
if settings.ADMIN_USERNAME and settings.ADMIN_PASSWORD:
async with async_session() as session:
result = await session.execute(
select(User).where(
User.email == f"{settings.ADMIN_USERNAME}@local",
User.auth_provider == "local",
)
)
if result.scalar_one_or_none() is None:
admin_user = User(
email=f"{settings.ADMIN_USERNAME}@local",
display_name=settings.ADMIN_USERNAME,
auth_provider="local",
is_admin=True,
)
session.add(admin_user)
await session.commit()
print(f" → Bootstrap admin created: {settings.ADMIN_USERNAME}")
# Check GeoLite2 database # Check GeoLite2 database
geo_db = settings.GEOLITE2_DB_PATH geo_db = settings.GEOLITE2_DB_PATH
if os.path.exists(geo_db): if os.path.exists(geo_db):