MCPcopy Create free account
hub / github.com/dfinity/orbit / evaluate

Method evaluate

core/station/impl/src/models/request_policy_rule.rs:322–338  ·  view source on GitHub ↗

Evaluates the request approval summary and returns the evaluation status based on the minimum approvals required. If the request does not yet have enough approvals to meet the minimum approvals required but has enough uncast approvals that could be cast to meet the minimum approvals required, then the evaluation is kept in the `Pending` state.

(&self, min_approved: usize)

Source from the content-addressed store, hash-verified

320 Context = (Arc<Request>, Arc<RequestPolicyRule>),
321 Error = EvaluateError,
322>: Sync + Send
323{
324 fn evaluate(&self, ctx: Context) -> Result<Status, Error>;
325}
326
327#[derive(Clone)]
328pub struct RequestPolicyRuleEvaluator {
329 pub user_matcher: Arc<dyn Match<UserInvolvedInPolicyRuleForRequestResource>>,
330 pub address_book_metadata_matcher: Arc<dyn Match<RequestHasMetadata>>,
331}
332
333struct RequestApprovalSummary {
334 total_possible_approvers: usize,
335 approvers: Vec<UserId>,
336 approved: usize,
337 rejected: usize,
338}
339
340impl RequestApprovalSummary {
341 /// Evaluates the request approval summary and returns the evaluation status based on the

Callers 4

evaluate_policy_rulesMethod · 0.45
can_approveMethod · 0.45
reevaluateMethod · 0.45

Calls 10

printFunction · 0.85
calculate_approvalsMethod · 0.80
is_matchMethod · 0.80
evaluate_policy_rulesMethod · 0.80
iterMethod · 0.80
allMethod · 0.80
get_accountMethod · 0.45
getMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected