I am designing a system that contains organizational hierarchy management. There are four roles in the system which are the user, admin, manager and head of procurement:

Current class diagram

I am trying to let the admin of each organization create his own hierarchy by creating new roles using tasks and privileges predefined in the system.

For example an admin might add a user named head of market research between user and head of procurement. The admin will assign this new user tasks like approving purchase requests which are predefined in the system.

I am trying to prepare a class diagram for this system and I don't know how to represent the new roles to be created. Any help is appreciated. Thank you in advance.

  • Is the system mean to handle multiple organizations at the same time? Are the admins of the organizations developers who write custom classes?
    – Theraot
    Feb 9, 2020 at 10:51

1 Answer 1


The issue that you have is that you merge the concept of user and the concept of role. So if the same person is head of procurement in several tasks, that person would have several unrelated objects.

A first step forward would be to use sound separation of concerns, for example as follows:

enter image description here

As you see, I renamed your initial "User" into "Contributor" to avoid the confusion between a specific role and a more general concept (e.g. you had addUser() but no addManager() nor addHeadOfProcurement()).

This design increases the flexibility, yet your application will have the opportunity to enforce some constraints (e.g. if your auditors want you to enforce some segregation of duties).

Nevertheless, this design still relies on predefined roles. An admin could not create new roles, but just reuse the ones available in your class model.

If you want a higher level of flexibility, so that your admin can create new roles you could :

  • either adopt an entity-component-system design for the roles. It means using composition of componennts instead of inheritance. Components would be individual responsibilities or behaviors, such as viewing tender, contributing with content, approving something, reset approvals, etc...
  • or define the roles as a composite of sub-roles, untile some predefined leaf-roles which would be the most elementary responsibilities for tasks.

Of course this additional flexibility would add another layer of complexity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.