Party visibility and Contract owner change on "to-do list" example


I’m trying to make a “to-do list” app in DAML, and I have two main problems.

  • 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
        masterAdmin: Party
        username: Party
        role: Role
        supporters: [Party]
        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:

  1. Admin add support to supporter list
  2. Support have what he have to
  3. Admin remove support from supporters list

Second problem:
Is very similar to first. I have a “task” template:

template Task 
        name: Text
        issuer: Party
        possibleExecutors: [Party]
        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

I figured out a solution.

First problem: stays uchanged. I think that a list, where I can add observer is the best solution for me so far.

Second problem (I wanted that admin could do anything): I used a dynamic signatory trick and this works just fine.
It’s Bernhard post in this topic:

1 Like

Really awesome to hear you figure it out :clap: (and were able to find a helpful post on the forum :slightly_smiling_face:)