Helpers for scoping MCP grants based on authentication state.
Unauthenticated sessions receive minimal read-only capabilities. After login,
pages should extend this base grant with role-specific capabilities in
agent_grant/1.
Summary
Functions
Returns guest grant when current_user is absent, otherwise logged_in_grant/1.
Base grant for unauthenticated sessions (agent-first / pre-login).
Default authenticated grant; override capabilities via opts.
Functions
Returns guest grant when current_user is absent, otherwise logged_in_grant/1.
Pages can pass extra capabilities to merge when authenticated:
def agent_grant(assigns) do
Dialup.Auth.Grants.for_user(assigns, capabilities: [:add_item])
end
@spec guest_grant() :: map()
Base grant for unauthenticated sessions (agent-first / pre-login).
Default authenticated grant; override capabilities via opts.