Resolve the role metadata file used to map role names to user ids.
(*, project_root: Optional[Path] = None)
| 27 | |
| 28 | |
| 29 | def roles_path(*, project_root: Optional[Path] = None) -> Path: |
| 30 | """Resolve the role metadata file used to map role names to user ids.""" |
| 31 | root = project_root or PROJECT_ROOT |
| 32 | configured = os.environ.get("PAPERFLOW_ROLES_PATH", "").strip() |
| 33 | if configured: |
| 34 | path = Path(configured).expanduser() |
| 35 | return path if path.is_absolute() else root / path |
| 36 | if project_root is not None: |
| 37 | # An explicit root is a deliberate override (tests, tooling); respect it. |
| 38 | return root / "data" / "roles.json" |
| 39 | # Otherwise resolve via the runtime root so an installed wheel does not |