confium_pki/delegation/
scope.rs1use crate::delegation::constraint::Constraint;
4use crate::delegation::operation::Operation;
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, Default, Serialize, Deserialize)]
9pub struct DelegationScope {
10 pub allowed_operations: Vec<Operation>,
12 pub constraints: Vec<Constraint>,
14}
15
16impl DelegationScope {
17 pub fn new() -> Self {
19 Self::default()
20 }
21
22 pub fn allow_operation(mut self, op: Operation) -> Self {
24 self.allowed_operations.push(op);
25 self
26 }
27
28 pub fn constrain(mut self, c: Constraint) -> Self {
30 self.constraints.push(c);
31 self
32 }
33}