pub struct ClassLevelPermissions { /* private fields */ }Expand description
Class-level permissions.
Constructed from the stored _metadata.class_permissions object or from a
POST/PUT /schemas body. Both paths keep Self::raw verbatim so that writing the block
back cannot drop a key parse-rust does not model.
No PartialEq, because Self::raw holds ParseValues and a derived comparison would
inherit that type’s float hazards. Compare the rendered JSON if two blocks need comparing.
Implementations§
Source§impl ClassLevelPermissions
impl ClassLevelPermissions
Sourcepub fn from_map(raw: ParseMap) -> Self
pub fn from_map(raw: ParseMap) -> Self
Parse a CLP block. Unknown keys are preserved in Self::raw and otherwise ignored;
rejecting them is the schema API’s job, not the model’s, because a block already in the
database has to be readable even if it would fail validation today.
Sourcepub fn raw(&self) -> &ParseMap
pub fn raw(&self) -> &ParseMap
The block exactly as it will be stored. Never derived from the parsed view.
Sourcepub fn op(&self, operation: Operation) -> Option<&OpPerm>
pub fn op(&self, operation: Operation) -> Option<&OpPerm>
The permission object for one operation.
None means unrestricted, not denied. Every caller has to spell that out; the reason
it cannot be unwrap_or_default() is the whole point of this module.
pub fn protected_fields(&self) -> &IndexMap<PfEntity, Vec<String>>
Sourcepub fn user_fields(&self, operation: Operation) -> &[String]
pub fn user_fields(&self, operation: Operation) -> &[String]
The class-wide pointer-field array for one operation, per
SchemaController.js:1425-1429.
pub fn read_user_fields(&self) -> &[String]
pub fn write_user_fields(&self) -> &[String]
Sourcepub fn applicable_pointer_fields(&self, operation: Operation) -> Vec<String>
pub fn applicable_pointer_fields(&self, operation: Operation) -> Vec<String>
Every pointer field that applies to an operation, per-op first then class-wide, deduped.
Order is upstream’s (DatabaseController.js:1749-1764) and matters, because the clauses
are composed into an $or whose element order is observable in a compiled query.
Trait Implementations§
Source§impl Clone for ClassLevelPermissions
impl Clone for ClassLevelPermissions
Source§fn clone(&self) -> ClassLevelPermissions
fn clone(&self) -> ClassLevelPermissions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more