pub fn check_permission(
        &self,
        action: Action,
        requester: Option<PublicKey>,
        policy_id: Option<&Identifier<ActorType>>,
    ) -> Result<()> {
        macro_rules! get_policy {
            ($policy_id: ident, $data: ident) => {
                match $policy_id {
                    Some(id) => match $data.policy_by_id(id) {
                        Some(policy) => Ok(Some(policy)),
                        None => Err(Error::OpNotCausallyReady),
                    },
                    None => Ok($data.policy()),
                }
            };
        }

        match (requester, &self.data) {
            (Some(requester), SeqData::Public(data)) => {
                let policy = get_policy!(policy_id, data)?;
                check_perm!(policy, requester, action)
            }
            (Some(requester), SeqData::Private(data)) => {
                let policy = get_policy!(policy_id, data)?;
                check_perm!(policy, requester, action)
            }
            (None, SeqData::Public(data)) => {
                let policy = get_policy!(policy_id, data)?;
                let requester = self.operations_pk;
                check_perm!(policy, requester, action)
            }
            (None, SeqData::Private(data)) => {
                let policy = get_policy!(policy_id, data)?;
                let requester = self.operations_pk;
                check_perm!(policy, requester, action)
            }
        }
    }
/// Helper to check permissions for given `action`
/// for the given requester's public key.
///
/// Returns:
/// `Ok(())` if the permissions are valid,
/// `Err::InvalidOwners` if the last owner is invalid,
/// `Err::AccessDenied` if the action is not allowed.
Helper to check permissions for given `action`
for the given requester's public key.


Helper to check permissions for given ` action ` for the given requester ' s public key .
pub fn check_permission(
        &self,
        action: Action,
        requester: Option<PublicKey>,
        policy_id: Option<&Identifier<ActorType>>,
    ) -> Result<()> {
        macro_rules! get_policy {
            ($policy_id: ident, $data: ident) => {
                match $policy_id {
                    Some(id) => match $data.policy_by_id(id) {
                        Some(policy) => Ok(Some(policy)),
                        None => Err(Error::OpNotCausallyReady),
                    },
                    None => Ok($data.policy()),
                }
            };
        }
        match (requester, &self.data) {
            (Some(requester), SeqData::Public(data)) => {
                let policy = get_policy!(policy_id, data)?;
                check_perm!(policy, requester, action)
            }
            (Some(requester), SeqData::Private(data)) => {
                let policy = get_policy!(policy_id, data)?;
                check_perm!(policy, requester, action)
            }
            (None, SeqData::Public(data)) => {
                let policy = get_policy!(policy_id, data)?;
                let requester = self.operations_pk;
                check_perm!(policy, requester, action)
            }
            (None, SeqData::Private(data)) => {
                let policy = get_policy!(policy_id, data)?;
                let requester = self.operations_pk;
                check_perm!(policy, requester, action)
            }
        }
    }
pub fn check_permission ( & self , action : Action , requester : Option < PublicKey > , policy_id : Option < & Identifier < ActorType > > , ) -> Result < ( ) > { macro_rules! get_policy { ( $policy_id : ident $data : ident ) => { match $policy_id { Some ( id ) match $data policy_by_id ( id ) { Some ( policy ) Ok ( Some ( policy ) ) None Err ( Error OpNotCausallyReady ) } None Ok ( $data policy ( ) ) } } ; } match ( requester , & self . data ) { ( Some ( requester ) , SeqData :: Public ( data ) ) => { let policy = get_policy ! ( policy_id data ) ? ; check_perm ! ( policy requester action ) } ( Some ( requester ) , SeqData :: Private ( data ) ) => { let policy = get_policy ! ( policy_id data ) ? ; check_perm ! ( policy requester action ) } ( None , SeqData :: Public ( data ) ) => { let policy = get_policy ! ( policy_id data ) ? ; let requester = self . operations_pk ; check_perm ! ( policy requester action ) } ( None , SeqData :: Private ( data ) ) => { let policy = get_policy ! ( policy_id data ) ? ; let requester = self . operations_pk ; check_perm ! ( policy requester action ) } } }
Helper to check permissions for given `action`
for the given requester's public key.
Helper to check permissions for given ` action ` for the given requester ' s public key .
&self
action
Action
requester
Option<PublicKey>
policy_id
Option<&Identifier<ActorType>>
&self
action
Action
requester
Option<PublicKey>
policy_id
Option<&Identifier<ActorType>>