Is my class diagram for multi user role based app right?

122 Views Asked by At

In my case, each user can be attributed one or multiple roles, some roles require extra attributes (for exp "agent maintenance" role hase "spécialité" field). The "Administrateur" role can add/change roles of other users. if my model works fine, is there any better representation? [piece of class diag](https://i.stack.imgur.com/D9ieA.png)

1

There are 1 best solutions below

0
Christophe On BEST ANSWER

Your model is fine:

  • multiplicity 1..* tells that a user can have one or more roles
  • each of the role can be an instance of one of the specialisation of the abstract role; each specialisation may therefore have different attributes.

However, nothing says that Administrator can change roles of others. There are plenty of ways to represent this, for example foresee in Administrator some operations dedicated to the management of the other proles.