mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-05-01 15:33:51 +02:00
* functional initial auth modal * k * k * k * looking good * k * k * k * k * update * k * k * misc bunch * improvements * k * address comments * k * nit * update * k
36 lines
1003 B
Python
36 lines
1003 B
Python
from typing import cast
|
|
|
|
from onyx.configs.constants import KV_PENDING_USERS_KEY
|
|
from onyx.configs.constants import KV_USER_STORE_KEY
|
|
from onyx.key_value_store.factory import get_kv_store
|
|
from onyx.key_value_store.interface import KvKeyNotFoundError
|
|
from onyx.utils.special_types import JSON_ro
|
|
|
|
|
|
def get_invited_users() -> list[str]:
|
|
try:
|
|
store = get_kv_store()
|
|
return cast(list, store.load(KV_USER_STORE_KEY))
|
|
except KvKeyNotFoundError:
|
|
return list()
|
|
|
|
|
|
def write_invited_users(emails: list[str]) -> int:
|
|
store = get_kv_store()
|
|
store.store(KV_USER_STORE_KEY, cast(JSON_ro, emails))
|
|
return len(emails)
|
|
|
|
|
|
def get_pending_users() -> list[str]:
|
|
try:
|
|
store = get_kv_store()
|
|
return cast(list, store.load(KV_PENDING_USERS_KEY))
|
|
except KvKeyNotFoundError:
|
|
return list()
|
|
|
|
|
|
def write_pending_users(emails: list[str]) -> int:
|
|
store = get_kv_store()
|
|
store.store(KV_PENDING_USERS_KEY, cast(JSON_ro, emails))
|
|
return len(emails)
|