How to setup rule in ACL file of Hyperledger Composer to validate against enum

0 votes
participant Employee identified by empID {
  o String empID
  o EmployeeCategory category
}

enum EmployeeCategory{ 
  o Internal 
  o External 
}

asset CompanyAsset identified by assetID{
  o String assetID  
  -->  Employee owner
  o String status 
}

transaction AssignStatus{
--> CompanyAsset assetObject 
}

Given above is a section of my module file. Now I want to define a rule in the acl file such that only if the logged in Participant employeeCategory is 'Internal' then allow to create/update the transaction AssignStatus

I was able to do it with the empID field but not for the enum which is what i want.

Jul 19, 2018 in Blockchain by sabby
• 4,370 points
1,368 views

1 answer to this question.

0 votes

Use these two ACL rules:

   rule InternalsOnly {
description: "Allow Internals to submit AssignStatus txn type"
participant(p): "org.acme.trading.Employee"
operation: ALL
resource(v): "org.acme.trading.AssignStatus"
  condition: ( p.category == "Internal" )
action: ALLOW   
}
 rule PreventTransaction {
description: "prevent others executing transactions"
participant: "org.acme.trading.Employee"
operation: ALL
resource: "org.acme.trading.AssignStatus"
action: DENY
}

This should solve your problem.

answered Jul 19, 2018 by Perry
• 17,100 points

Related Questions In Blockchain

0 votes
1 answer

How to control visibility of assets in Hyperledger Fabric?

you can use proof of Authority consensus ...READ MORE

answered Jul 10, 2018 in Blockchain by digger
• 26,740 points
820 views
0 votes
1 answer

How to solve EACCES:permission denied error in Hyperledger Composer?

It seems like there is no required ...READ MORE

answered Jul 11, 2018 in Blockchain by digger
• 26,740 points
2,472 views
0 votes
1 answer

How to solve "error trying install composer runtime" in Hyperledger composer?

I think the docker-compose tool is not ...READ MORE

answered Jul 17, 2018 in Blockchain by slayer
• 29,370 points
909 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,469 views
+1 vote
1 answer
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 26,740 points
1,037 views
0 votes
1 answer

How to send events in Hyperledger Composer?

You define the event in your .cto ...READ MORE

answered Aug 25, 2018 in Blockchain by Perry
• 17,100 points
1,524 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP