pub enum BlockOp {
InsertDeleteLines,
RemoveBlock,
ModifySchema,
CellInput,
SortByField,
ModifyDescription,
OverrideValidation,
}Expand description
The operations a block’s permissions can speak about separately.
One policy for the whole block is too blunt for the case this exists to serve: a block a craft or Watson built usually wants the user to keep typing into it while refusing to let them pull rows out from under it or re-point its schema, which would take the block out of the owner’s control for good.
Variants§
InsertDeleteLines
Insert or delete rows/columns inside the block.
RemoveBlock
Delete the whole block. Kept apart from the rest because it is the one operation there is no recovering from by editing: the records, the schema and this policy itself all go at once.
ModifySchema
Bind a different schema, or change the fields of the current one.
CellInput
Write a value into one of the block’s cells.
SortByField
Reorder the records by one of the fields.
ModifyDescription
Rewrite the prose description.
OverrideValidation
Write a value into a block cell that its field’s validation rule rejects.
Distinct from CellInput because the two answer different questions:
CellInput is “may this actor write here at all”, this one is “may
this actor write something the schema says is wrong”. A craft that
maintains a table often has to seed a row it knows is incomplete —
a required field it fills in on the next round — while a person typing
into the same block should be held to the rule. Left at All (the
default), a violating write lands and is flagged, which is what every
block did before this op existed.
Implementations§
Source§impl BlockOp
impl BlockOp
Sourcepub const ALL: [BlockOp; 7]
pub const ALL: [BlockOp; 7]
Every operation, so a caller can render or check the whole set without having to keep its own list in step with this one.
Sourcepub fn for_payload_type(payload_type: &str) -> Option<BlockOp>
pub fn for_payload_type(payload_type: &str) -> Option<BlockOp>
Which operation a payload counts as, keyed by the payload’s wire type
name (EditPayload’s type tag). None when the payload is not
something a block can single out.
The mapping belongs to the engine because the engine defines the
operations. Every host that enforces a policy needs it — the app, the
craft runtime, Watson — and each keeping its own table is how the same
payload comes to be governed differently in different hosts. A payload
this returns None for is not unguarded: the caller falls back to its
owner check, which is what the app already did.
Sourcepub fn as_wire_str(&self) -> &'static str
pub fn as_wire_str(&self) -> &'static str
Attribute name used for .xlsx persistence.
Trait Implementations§
impl Copy for BlockOp
Source§impl<'de> Deserialize<'de> for BlockOp
impl<'de> Deserialize<'de> for BlockOp
Source§fn deserialize<D>(
deserializer: D,
) -> Result<BlockOp, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<BlockOp, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for BlockOp
Source§impl Serialize for BlockOp
impl Serialize for BlockOp
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for BlockOp
Auto Trait Implementations§
impl Freeze for BlockOp
impl RefUnwindSafe for BlockOp
impl Send for BlockOp
impl Sync for BlockOp
impl Unpin for BlockOp
impl UnsafeUnpin for BlockOp
impl UnwindSafe for BlockOp
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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<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 moreimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.