STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
userdata.py
Go to the documentation of this file.
1"""Per-user data storage for EngineDesign.
2
3A thin binding of :mod:`stardesign.userdata` to this app's ``<app>`` segment.
4The names below are re-exported deliberately: every call site in this backend
5says ``userdata.current_user(request)``, and keeping that shape is what let the
6shared package land without touching any of them.
7
8See stardesign/userdata.py for the layout, the identity rules, and why the path
9sanitising matters now that ``?owner=`` can name another user's folder.
10"""
11
12from pathlib import Path
13
14from stardesign.userdata import UserData, slug_user, slugify # noqa: F401
15
16#: The ``<app>`` path segment for this backend. Distinct per app.
17APP = "engine"
18
19# backend/userdata.py -> backend -> <subproject>. Used only when USERDATA_DIR is
20# unset (dev): a gitignored dir next to the app, created on demand.
21_DEFAULT_ROOT = Path(__file__).resolve().parents[1] / ".userdata"
22
23store = UserData(APP, default_root=_DEFAULT_ROOT)
24
25current_user = store.current_user
26user_dir = store.user_dir
27all_users = store.all_users
28list_configs = store.list_configs
29read_config = store.read_config
30write_config = store.write_config
31delete_config = store.delete_config