pub enum ReadPredicate {
Show 15 variants
AuthNotNull,
AuthIsNull,
AuthIsSystem,
HasRole {
role: &'static str,
},
InTenant {
tenant_id: &'static str,
},
AuthFieldEqLiteral {
auth_field: &'static str,
value: PolicyLiteral,
},
AuthFieldNeLiteral {
auth_field: &'static str,
value: PolicyLiteral,
},
FieldIsTrue {
column: &'static str,
},
FieldEqLiteral {
column: &'static str,
value: PolicyLiteral,
},
FieldNeLiteral {
column: &'static str,
value: PolicyLiteral,
},
FieldInLiterals {
column: &'static str,
values: &'static [PolicyLiteral],
},
FieldNotInLiterals {
column: &'static str,
values: &'static [PolicyLiteral],
},
FieldEqAuth {
column: &'static str,
auth_field: &'static str,
},
FieldNeAuth {
column: &'static str,
auth_field: &'static str,
},
Relation {
quantifier: RelationQuantifier,
parent_table: &'static str,
parent_column: &'static str,
related_table: &'static str,
related_column: &'static str,
expr: &'static PolicyExpr,
},
}Variants§
AuthNotNull
AuthIsNull
AuthIsSystem
Lowered from auth().isSystem() (issue #486 / ADR 0038 blocker
B1). Satisfied only by a CratestackContext minted through
cratestack_core::SystemContext.
This is a predicate a schema author writes down, not a bypass:
it can only make a policy TRUE where an @@allow/@@deny
clause names it. A model whose policies never mention it is
entirely unaffected by system callers — the pre-existing
default-deny / owner-scoped rules for that action still apply,
which is the fail-closed property design constraint #2 asks for.
HasRole
InTenant
AuthFieldEqLiteral
AuthFieldNeLiteral
FieldIsTrue
FieldEqLiteral
FieldNeLiteral
FieldInLiterals
field in [A, B, C] (issue #666) — a set membership test that
lowers to a single column IN ($1, $2, $3), one bind slot per
element.
This is the multi-value shape FieldEqLiteral deliberately did
not grow: field == A || field == B already expresses the same
policy through the Or combinator, but it repeats the column
name once per variant and produces a nested Or tree in the
rendered SQL rather than one flat IN.
values is never empty — the macro rejects field in [] at
compile time, because an empty set is a constant FALSE that
reads as a policy and because SQL has no valid IN () form.
The SQL emitters still handle the empty case as a constant
rather than trusting that invariant.
FieldNotInLiterals
field not in [A, B, C] — the negation of Self::FieldInLiterals,
lowering to column NOT IN (...).
Note the SQL-level asymmetry this inherits from IN: a NULL in
column makes both IN and NOT IN evaluate to NULL, so
neither matches. That is why literal comparisons are restricted
to required fields (see
cratestack-macros/src/policy/model/enum_literal.rs) — a
nullable column would silently drop rows from both branches.
FieldEqAuth
FieldNeAuth
Relation
Trait Implementations§
Source§impl Clone for ReadPredicate
impl Clone for ReadPredicate
Source§fn clone(&self) -> ReadPredicate
fn clone(&self) -> ReadPredicate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ReadPredicate
Source§impl Debug for ReadPredicate
impl Debug for ReadPredicate
impl Eq for ReadPredicate
Source§impl PartialEq for ReadPredicate
impl PartialEq for ReadPredicate
impl StructuralPartialEq for ReadPredicate
Auto Trait Implementations§
impl Freeze for ReadPredicate
impl RefUnwindSafe for ReadPredicate
impl Send for ReadPredicate
impl Sync for ReadPredicate
impl Unpin for ReadPredicate
impl UnsafeUnpin for ReadPredicate
impl UnwindSafe for ReadPredicate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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 more