Hello!
I’m trying to make a “to-do list” app in DAML, and I have two main problems.
First:
Assumptions:
- Users have 3 roles (admin, support or user)
- Only admin can create new users
- Admin and support can change other user’s role (e.g. support can change user role from “user” to “support”)
- If possible: Support is able to see all Users, but User cannot see other User
What I have:
If admin create an user, and this user is not visible to anyone except admin
user template:
template UserModel
with
masterAdmin: Party
username: Party
role: Role
supporters: [Party]
where
signatory masterAdmin
observer login, supporters
What I want:
Support should be able to change role of every created user. Is delegation pattern only way to do it? Now I have empty Party list on every user, and if I want Support to change user role:
- Admin add support to supporter list
- Support have what he have to
- Admin remove support from supporters list
Second problem:
Is very similar to first. I have a “task” template:
template Task
with
name: Text
issuer: Party
possibleExecutors: [Party]
where
signatory issuer
observer possibleExecutors
What I want:
- My issuer should be able to add every user to “possibleExecutors”. (so we go back to first problem)
- Admin should have the same possibilities as Issuer (e.g. my issuer is not available and I as admin want to exercise every choice, e.g. mark task as done).
What I can achieve that? Is there any way to archive and recreate contract with other issuer?
At the end, I want to do these things on front-end side or API calls (but I don’t think that this make any differcence)
I’m sorry, if anything is not clear here