pub struct Caller {
pub org_id: i64,
pub org_public_id: String,
pub user_id: Option<Uuid>,
pub role: OrgRole,
pub is_platform_user: bool,
pub is_internal: bool,
}Expand description
Auth context passed from API handler to service layer.
Replaces raw org_id: i64 parameter on service methods. Carries all
information needed for policy evaluation.
Fields§
§org_id: i64Internal organization ID (for database queries).
org_public_id: StringExternal organization public ID.
user_id: Option<Uuid>Authenticated user ID (None for API key auth without user context).
role: OrgRoleUser’s role in the organization.
is_platform_user: boolWhether the caller is a platform user (email allowlist).
is_internal: boolWhether the caller originates from an internal server path.
Implementations§
Source§impl Caller
impl Caller
Sourcepub fn internal(org_id: i64) -> Self
pub fn internal(org_id: i64) -> Self
Create an internal/platform caller with Owner role.
Used for gRPC service calls (worker ↔ server) and other internal operations that should bypass all policy checks.
THREAT[TM-AUTHZ-002]: This constructs an Owner / is_internal caller
that bypasses ALL policy evaluation for the given org_id. The worker
control plane builds it from the CLIENT-SUPPLIED req.org_id on every
RPC, so a single valid worker bearer token can act on ANY org — there is
no per-org token scoping. The full tenant-isolation guarantee on the
worker boundary therefore rests on (1) network isolation of that
boundary (it MUST never be reachable from untrusted networks) and (2)
the shared worker secret, which is constant-time compared in the gRPC
auth interceptor. Only ever call this from trusted gRPC/internal paths.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Caller
impl RefUnwindSafe for Caller
impl Send for Caller
impl Sync for Caller
impl Unpin for Caller
impl UnsafeUnpin for Caller
impl UnwindSafe for Caller
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request