fn transactor_role() {
        let signer = new_signer();
        let pub_key = signer.public_key().expect("Failed to get pub key");
        let batch = create_batches(1, 1, &*signer).into_iter().nth(0).unwrap();

        {
            let mut on_chain_identities = TestIdentitySource::default();
            on_chain_identities.add_policy(create_policy(
                "policy1",
                vec![Permission::PermitKey(pub_key.as_hex())],
            ));
            on_chain_identities.add_role(create_role("transactor", "policy1"));

            let permission_verifier = on_chain_verifier(on_chain_identities);
            assert!(permission_verifier
                .is_batch_signer_authorized(&batch)
                .unwrap());
        }
        {
            let mut on_chain_identities = TestIdentitySource::default();
            on_chain_identities.add_policy(create_policy(
                "policy1",
                vec![Permission::DenyKey(pub_key.as_hex())],
            ));
            on_chain_identities.add_role(create_role("transactor", "policy1"));

            let permission_verifier = on_chain_verifier(on_chain_identities);
            assert!(!permission_verifier
                .is_batch_signer_authorized(&batch)
                .unwrap());
        }
    }
/// Test that role: "transactor" is checked properly.
///     1. Set policy to permit signing key. Batch should be allowed.
///     2. Set policy to permit some other key. Batch should be rejected.
Test that role: "transactor" is checked properly.
1. Set policy to permit signing key. Batch should be allowed.
2. Set policy to permit some other key. Batch should be rejected.
Test that role : " transactor " is checked properly . 1 . Set policy to permit signing key . Batch should be allowed . 2 . Set policy to permit some other key . Batch should be rejected .
fn transactor_role() {
        let signer = new_signer();
        let pub_key = signer.public_key().expect("Failed to get pub key");
        let batch = create_batches(1, 1, &*signer).into_iter().nth(0).unwrap();
        {
            let mut on_chain_identities = TestIdentitySource::default();
            on_chain_identities.add_policy(create_policy(
                "policy1",
                vec![Permission::PermitKey(pub_key.as_hex())],
            ));
            on_chain_identities.add_role(create_role("transactor", "policy1"));
            let permission_verifier = on_chain_verifier(on_chain_identities);
            assert!(permission_verifier
                .is_batch_signer_authorized(&batch)
                .unwrap());
        }
        {
            let mut on_chain_identities = TestIdentitySource::default();
            on_chain_identities.add_policy(create_policy(
                "policy1",
                vec![Permission::DenyKey(pub_key.as_hex())],
            ));
            on_chain_identities.add_role(create_role("transactor", "policy1"));
            let permission_verifier = on_chain_verifier(on_chain_identities);
            assert!(!permission_verifier
                .is_batch_signer_authorized(&batch)
                .unwrap());
        }
    }
fn transactor_role ( ) { let signer = new_signer ( ) ; let pub_key = signer . public_key ( ) . expect ( " " ) ; let batch = create_batches ( 1 , 1 , & * signer ) . into_iter ( ) . nth ( 0 ) . unwrap ( ) ; { let mut on_chain_identities = TestIdentitySource :: default ( ) ; on_chain_identities . add_policy ( create_policy ( " " , vec ! [ Permission PermitKey ( pub_key as_hex ( ) ) ] , ) ) ; on_chain_identities . add_role ( create_role ( " " , " " ) ) ; let permission_verifier = on_chain_verifier ( on_chain_identities ) ; assert ! ( permission_verifier is_batch_signer_authorized ( batch ) unwrap ( ) ) ; } { let mut on_chain_identities = TestIdentitySource :: default ( ) ; on_chain_identities . add_policy ( create_policy ( " " , vec ! [ Permission DenyKey ( pub_key as_hex ( ) ) ] , ) ) ; on_chain_identities . add_role ( create_role ( " " , " " ) ) ; let permission_verifier = on_chain_verifier ( on_chain_identities ) ; assert ! ( permission_verifier is_batch_signer_authorized ( batch ) unwrap ( ) ) ; } }
Test that role: "transactor" is checked properly.
Test that role : " transactor " is checked properly .