A backend-neutral, explainable relationship-based authorization toolkit for MoonBit.
pub(all) struct CheckRequest {
object : ObjectRef
permission : String
principal : SubjectRef
} derive(Eq, Debug)fn CheckRequest::new(object : ObjectRef, permission : String, principal : SubjectRef) -> CheckRequestpub(all) struct DecisionChange {
request : CheckRequest
kind : DecisionChangeKind
before : CheckResult
after : CheckResult
} derive(Debug)pub(all) struct PolicyEngine {
tuples : Array[RelationTuple]
rules : Array[PolicyRule]
max_depth : Int
} derive(Debug)fn PolicyEngine::check(self : PolicyEngine, object : ObjectRef, permission : String, principal : SubjectRef) -> CheckResultfn PolicyEngine::check_many(self : PolicyEngine, requests : Array[CheckRequest]) -> Array[CheckResult]fn PolicyEngine::filter_allowed(self : PolicyEngine, objects : Array[ObjectRef], permission : String, principal : SubjectRef) -> Array[ObjectRef]pub(all) struct PolicyImpactReport {
changes : Array[DecisionChange]
newly_allowed : Int
newly_denied : Int
unchanged : Int
} derive(Debug)fn PolicyRule::direct_allow(object_namespace : String, permission : String, source_relation : String) -> PolicyRulefn PolicyRule::direct_deny(object_namespace : String, permission : String, source_relation : String) -> PolicyRulefn PolicyRule::traverse_allow(object_namespace : String, permission : String, source_relation : String, target_permission : String) -> PolicyRulefn PolicyRule::traverse_deny(object_namespace : String, permission : String, source_relation : String, target_permission : String) -> PolicyRulepub(all) struct RelationTuple {
object : ObjectRef
relation : String
subject : SubjectRef
} derive(Eq, Debug)fn analyze_policy_impact(before : PolicyEngine, after : PolicyEngine, requests : Array[CheckRequest]) -> PolicyImpactReportA backend-neutral, explainable relationship-based authorization toolkit for MoonBit.