Replace SQL database with JSONL based solution that keeps history.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
from collections.abc import Sequence
|
||||
from fnmatch import fnmatchcase
|
||||
|
||||
from paskia.globals import db
|
||||
from paskia import db
|
||||
from paskia.util.hostutil import normalize_host
|
||||
from paskia.util.tokens import session_key
|
||||
|
||||
@@ -29,4 +29,4 @@ async def session_context(auth: str | None, host: str | None = None):
|
||||
if not auth:
|
||||
return None
|
||||
normalized_host = normalize_host(host) if host else None
|
||||
return await db.instance.get_session_context(session_key(auth), normalized_host)
|
||||
return await db.get_session_context(session_key(auth), normalized_host)
|
||||
|
||||
@@ -4,7 +4,7 @@ from datetime import timezone
|
||||
|
||||
from paskia import aaguid
|
||||
from paskia.authsession import session_key
|
||||
from paskia.globals import db
|
||||
from paskia import db
|
||||
from paskia.util import hostutil, permutil, tokens, useragent
|
||||
|
||||
|
||||
@@ -41,17 +41,17 @@ async def format_user_info(
|
||||
- Sessions list
|
||||
- Permissions
|
||||
"""
|
||||
u = await db.instance.get_user_by_uuid(user_uuid)
|
||||
u = await db.get_user_by_uuid(user_uuid)
|
||||
ctx = await permutil.session_context(auth, request_host)
|
||||
|
||||
# Fetch and format credentials
|
||||
credential_ids = await db.instance.get_credentials_by_user_uuid(user_uuid)
|
||||
credential_ids = await db.get_credentials_by_user_uuid(user_uuid)
|
||||
credentials: list[dict] = []
|
||||
user_aaguids: set[str] = set()
|
||||
|
||||
for cred_id in credential_ids:
|
||||
try:
|
||||
c = await db.instance.get_credential_by_id(cred_id)
|
||||
c = await db.get_credential_by_id(cred_id)
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
@@ -98,7 +98,7 @@ async def format_user_info(
|
||||
|
||||
# Format sessions
|
||||
normalized_request_host = hostutil.normalize_host(request_host)
|
||||
session_records = await db.instance.list_sessions_for_user(user_uuid)
|
||||
session_records = await db.list_sessions_for_user(user_uuid)
|
||||
current_session_key = session_key(auth)
|
||||
sessions_payload: list[dict] = []
|
||||
|
||||
@@ -150,7 +150,7 @@ async def format_reset_user_info(user_uuid, reset_token) -> dict:
|
||||
Returns:
|
||||
Dictionary with minimal user info for password reset flow
|
||||
"""
|
||||
u = await db.instance.get_user_by_uuid(user_uuid)
|
||||
u = await db.get_user_by_uuid(user_uuid)
|
||||
|
||||
return {
|
||||
"authenticated": False,
|
||||
|
||||
Reference in New Issue
Block a user