File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
rust/rbac-registration/src/cardano/cip509 Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ use validation::{
2727use super :: transaction:: witness:: TxWitness ;
2828use crate :: {
2929 cardano:: cip509:: {
30- rbac:: Cip509RbacMetadata ,
30+ rbac:: { Cip509RbacMetadata , RoleData , RoleNumber } ,
3131 types:: { TxInputHash , ValidationSignature } ,
3232 x509_chunks:: X509Chunks ,
3333 } ,
@@ -171,6 +171,20 @@ impl Cip509 {
171171 }
172172 }
173173
174+ /// Returns all role numbers present in this `Cip509` instance.
175+ pub fn all_roles ( & self ) -> Vec < RoleNumber > {
176+ self . metadata
177+ . map ( |m| m. role_data . keys ( ) )
178+ . iter ( )
179+ . flatten ( )
180+ . collect ( )
181+ }
182+
183+ /// Returns a role data for the given role if it is present.
184+ pub fn role_data ( & self , role : RoleNumber ) -> Option < & RoleData > {
185+ self . metadata . and_then ( |m| m. role_data . get ( & role) )
186+ }
187+
174188 // TODO: FIXME: Consume fields in the registration chain, use methods everywhere else.
175189 // /// Returns a registration purpose.
176190 // #[must_use]
You can’t perform that action at this time.
0 commit comments