Class BowireUserContext
- Namespace
- Kuestenlogik.Bowire.Auth
- Assembly
- Kuestenlogik.Bowire.dll
Static facade the per-user stores call through to resolve paths.
Defaults to Instance; the host
can swap in a request-aware implementation by setting
Current at startup (single-user override) or via an
async-local HttpContext-driven middleware (multi-tenant mode,
once SCIM lands).
public static class BowireUserContext
- Inheritance
-
BowireUserContext
- Inherited Members
Properties
Current
The resolver in force here: whatever Enter(IBowireUserStore) is holding on this execution context, and otherwise the host's.
public static IBowireUserStore Current { get; set; }
Property Value
Remarks
Assigning replaces the host's resolver — the one every call with no scope of its own gets — and is a start-up move. It does not disturb a scope already open elsewhere.
Methods
Enter(IBowireUserStore)
Resolve against store until the returned scope is
disposed.
public static IDisposable Enter(IBowireUserStore store)
Parameters
storeIBowireUserStoreThe store this execution context should use.
Returns
Remarks
One process, more than one storage root. An embedded host serving two
Bowire instances, and a test that must not reach the developer's real
~/.bowire, want the same thing: a store that belongs to a piece
of work rather than to the process.
Restoring the previous value rather than clearing it, for the reason Enter(string) gives: a nested scope is legitimate, and clearing would silently drop the outer one for the rest of the work.
It rides an AsyncLocal<T>, so it reaches whatever flows
from here and nothing else. Notably TestServer drops the
caller's execution context unless
TestServer.PreserveExecutionContext is set, so a scope opened
around a request through one is not seen by the handler — quietly,
by falling back to the host's resolver.
GetUserPath(string)
Convenience: resolve filename under the
active user store. Equivalent to Current.GetUserPath(filename).
Stores call this to keep their existing static shape while
participating in the user-scoping seam.
public static string GetUserPath(string filename)
Parameters
filenamestring
Returns
GetWorkspacePath(string, string?, string)
#147 — resolve a per-workspace path. When storageRoot
is set (git-backed workspace, the operator points the workspace
at a checked-out folder), the resolver returns
<storageRoot>/<relativePath>. Otherwise falls
back to the legacy per-user layout under
~/.bowire/workspaces/<workspaceId>/<relativePath>.
Stores call this to participate in the git-workspace seam
without having to thread storageRoot through every method.
public static string GetWorkspacePath(string workspaceId, string? storageRoot, string relativePath)
Parameters
workspaceIdstringWorkspace identifier. Used as a path segment in the default- folder fallback path; ignored when
storageRootis set.storageRootstringOptional absolute path to a git-backed workspace's root.
relativePathstringPath relative to the workspace root — e.g. "environments/staging.json", "recordings/login.json".