2

I have to create a set of user roles and permissions for sets of teams.

Users with a "coordinator" role would be able to create and manage a set of subordinate accounts.

The 'coordinator' role should also be able to edit content created by one of their own subordinates - but no one others.

If the coordinator were to change, it should be possible to assign their existing permissions and privileges in regards to their subordinates to a new user.

Is this easy to do with Drupal 8?

2

Your question looks like a perfect fit for the Group module, which can be used to create collections of content (nodes) that can be accessed by sets of users and with variations of access levels, such as none, read only, edit, etc.

Have a look at the answer to "What are the alternatives for the Organic groups module?" for a brief introduction to the Group module.

For this specific question, here is a blueprint of how it could be used/configured:

  • Group Type: Teams
  • Group Roles (refer to "What are the various roles supported by the Group module?" for more details):
    • Coordinator.
    • Team Member (or whatever fits), used for those who have access to a Team's content.
  • Groups: 1 such group for each team (simple as that ...).
  • Optional (not sure if you want this): If a user creates a new group, then automatically assign the "Group Owner"-role to the user who created the group.
  • Group permissions: grant permission to the user with role "Group Owner" to perform actions like "Add members" or "Invite members to join".

Special case: "If the coordinator were to change" (as in your question), then simply tune the permissions to grant the "Coordinator" role to another appropriate user (how easy can it be ...).

To use the Group module from within a custom module, start from its Development guide and/or have a look at its API for D7 or API for D8.

Resources

PS: Even though this question is related to D8, this answer applies for either D7 ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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