pub struct Acl<C: Config, const N: usize = 20, const S: usize = 4, const T: usize = 3> { /* private fields */ }Expand description
A node’s Access Control List, and the decision it exists to make (§6.6).
N is how many entries the list holds across every fabric, and S and T how many
subjects and targets one entry may name. All three default to the specification’s minima for
a five-fabric node; Acl::CHECK refuses anything smaller, against the Config the list is
parameterised by, so a node cannot promise a share of a list it does not have.
Implementations§
Source§impl<C: Config, const N: usize, const S: usize, const T: usize> Acl<C, N, S, T>
impl<C: Config, const N: usize, const S: usize, const T: usize> Acl<C, N, S, T>
Sourcepub const CHECK: ()
pub const CHECK: ()
Compile-time proof that this list can keep §2.11.1.1’s promise, and that its entries are wide enough for §9.10.6.5 and §9.10.6.6.
at least four Access Control Entries available for every fabric supported by the node
S and T are the values SubjectsPerAccessControlEntry and
TargetsPerAccessControlEntry report, and their constraints are 4 to 65534 and
3 to 65534 — so a narrower entry is a node whose own attribute is out of constraint.
Source§impl<C: Config, const N: usize, const S: usize, const T: usize> Acl<C, N, S, T>
impl<C: Config, const N: usize, const S: usize, const T: usize> Acl<C, N, S, T>
Sourcepub fn of_fabric(
&self,
fabric: FabricIndex,
) -> impl Iterator<Item = &Entry<S, T>>
pub fn of_fabric( &self, fabric: FabricIndex, ) -> impl Iterator<Item = &Entry<S, T>>
The entries belonging to one fabric — what a read of the ACL attribute reports.
§9.10.6’s ACL attribute is F, fabric-scoped, so a client sees its own fabric’s
entries and no others.
Sourcepub fn len_of_fabric(&self, fabric: FabricIndex) -> usize
pub fn len_of_fabric(&self, fabric: FabricIndex) -> usize
How many entries one fabric has, against Config::ACL_ENTRIES_PER_FABRIC.
Sourcepub fn add(&mut self, entry: Entry<S, T>) -> Result<()>
pub fn add(&mut self, entry: Entry<S, T>) -> Result<()>
Adds an entry.
Refuses one §6.6 does not permit to exist — a PASE entry, a Group entry at Administer,
an entry on no fabric, or a malformed target — with ErrorCode::InvalidArgument,
and a fabric already at its quota with ErrorCode::NoSpace.
Sourcepub fn add_admin_for_fabric(
&mut self,
fabric: FabricIndex,
subject: NodeId,
) -> Result<()>
pub fn add_admin_for_fabric( &mut self, fabric: FabricIndex, subject: NodeId, ) -> Result<()>
Adds §11.18.6.8 step 7’s administrator entry for a fabric just joined.
AddNOC carries a CaseAdminSubject, and the specification fixes exactly what the
resulting entry must be:
{ FabricIndex: <new>, Privilege: Administer, AuthMode: CASE,
Subjects: [CaseAdminSubject], Targets: [] } // entire nodeIt exists as a named constructor because the consequence of getting it wrong is not a visible failure. §11.18.6.8: “Unless such an Access Control Entry is added atomically as described here, there would be no way for the caller on its given Fabric to eventually add another Access Control Entry for CASE authentication mode” — the fabric is joined, the node advertises itself, and the moment the PASE session closes nobody can administer it again.
subject must be an operational node id or a CAT; anything else is
ErrorCode::InvalidArgument, which is the condition §11.18.6.8 answers with
InvalidAdminSubject.
Sourcepub fn remove_fabric(&mut self, fabric: FabricIndex)
pub fn remove_fabric(&mut self, fabric: FabricIndex)
Removes every entry of one fabric — §6.6.4’s side-effect of RemoveFabric.
A fabric’s entries must not outlive it. Left behind, they would be matched by the next fabric to be issued the same index, handing a new administrator the privileges of a removed one.
Sourcepub fn replace_fabric(
&mut self,
fabric: FabricIndex,
entries: impl IntoIterator<Item = Entry<S, T>>,
) -> Result<()>
pub fn replace_fabric( &mut self, fabric: FabricIndex, entries: impl IntoIterator<Item = Entry<S, T>>, ) -> Result<()>
Replaces one fabric’s entries, which is how §10.6.4.3.1’s list write lands.
A write of the whole ACL attribute replaces only the accessing fabric’s entries;
every other fabric’s are untouched, because they were never visible to the writer.
Sourcepub fn granted(
&self,
node: &Node<'_>,
subject: &SubjectDescriptor,
endpoint: EndpointId,
cluster: ClusterId,
) -> Granted
pub fn granted( &self, node: &Node<'_>, subject: &SubjectDescriptor, endpoint: EndpointId, cluster: ClusterId, ) -> Granted
§6.6.6.2’s get_granted_privileges: every privilege this action holds here.
Follows the pseudocode clause by clause. The order of the checks is not cosmetic — a fabric mismatch is rejected before an auth mode, and both before any subject is compared — because each one is what makes the next one’s comparison meaningful.
Sourcepub fn allows(
&self,
node: &Node<'_>,
subject: &SubjectDescriptor,
endpoint: EndpointId,
cluster: ClusterId,
required: Privilege,
) -> Outcome
pub fn allows( &self, node: &Node<'_>, subject: &SubjectDescriptor, endpoint: EndpointId, cluster: ClusterId, required: Privilege, ) -> Outcome
Whether an action holding required may proceed.
The shape AccessControl wants. Restricted is never
returned: §6.6.2.8’s Access Restriction List belongs to the ManagedDevice feature,
which this build does not implement, and inventing a restriction would deny access the
specification grants.