pub struct EditFacts<'a> {
pub required: Result<bool, String>,
pub mesh_enabled: bool,
pub task: Option<(&'a str, &'a [String])>,
pub session: Option<&'a str>,
pub claims: ClaimSource,
}Expand description
The facts one edit is judged from, gathered by the caller so that this function reads nothing and can be proved on every combination.
use majordomus_cli::guard::{judge_facts, ClaimSource, EditFacts};
let scope = vec!["lib".to_string()];
let facts = EditFacts {
required: Ok(true),
mesh_enabled: true,
task: Some(("t-1", &scope[..])),
session: None,
claims: ClaimSource::Unavailable("not asked".into()),
};
let v = judge_facts("lib/a.sh", Some("lib/a.sh"), facts);
assert_eq!((v.allowed, v.ground.as_str()), (true, "task"), "the task's scope decides first");Fields§
§required: Result<bool, String>session.edits_require_claim, or why the policy could not be read.
mesh_enabled: boolWhether the repository declares its mesh enabled.
task: Option<(&'a str, &'a [String])>The active task’s id and scope, when one is active in this checkout.
session: Option<&'a str>The writing session’s id on the mesh, when the caller knows it.
claims: ClaimSourceThe mesh’s live claims.
Auto Trait Implementations§
impl<'a> Freeze for EditFacts<'a>
impl<'a> RefUnwindSafe for EditFacts<'a>
impl<'a> Send for EditFacts<'a>
impl<'a> Sync for EditFacts<'a>
impl<'a> Unpin for EditFacts<'a>
impl<'a> UnsafeUnpin for EditFacts<'a>
impl<'a> UnwindSafe for EditFacts<'a>
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
Mutably borrows from an owned value. Read more