Skip to main content

Creating Rules - Part 2

In the previous lessons, we added 5 rules. In order for them to be triggered when transactions are issued, we need to attach them to a role.

Thankfully, we've already created a role, voter, that is attached to all of the auth records in our ledger.

We'll give you the code for adding the rules to the relevant rule.

[  {    "_id": ["_role/id", "voter"],    "rules": [      ["_rule/id", "editChanges"],      ["_rule/id", "editVotes"],      ["_rule/id", "editOwnUser"],      ["_rule/id", "viewUsers"],      ["_rule/id", "viewAuth"]    ]  }]

In this section, we'll challenge you to figure out what comes next.

The vote/yesVotes and vote/noVotes predicates contain references to the records that approve (yesVotes) or disapprove (noVotes) of the relevant changes.

What Comes Next?

What smart function (restriction) should we add to the predicate, vote/yesVotes and vote/noVotes?

We expect you to answer using words, rather than trying to write the code of the smart function yourself.