Here is a generic
holochain_roles mixin I’m working on in EYSS.
It’s designed to be generic and reusable, and only assumes an “Admin” role that has the ability of assigning and unassigning roles. It also assumes the “progenitor” pattern, in which there needs to be a property in the DNA that specifies the first “Admin” in the app.
The main usage in other happs will be check in the validation rules if a certain agent had a certain role when they committed and action. I’m still waiting to refine the validation rules to prevent any possible vector attacks, like mocking the timestamp of your actions, etc.
Disclaimer: right now the tests are manual, since there is no way right now for Tryorama tests to add the “progenitor” parameter to the DNA.
Feel free to comment, ask for new features, or pull-requests.