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,050 points
318 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 16,450 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
• 27,620 points
74 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
• 27,620 points
265 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,040 points
64 views
0 votes
1 answer
+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
• 27,620 points
52 views
0 votes
1 answer

How to send events in Hyperledger Composer?

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

answered Aug 24, 2018 in Blockchain by Perry
• 16,450 points
329 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.