2

I want to ask is it possible to assign customized roles to particular users at the node edit page? For example, the node author/admin can assign "editor" role to user A & user B and assign "admin" role to user C at the node edit page. The node access control is different among different nodes and different users.

I found some related modules such as Permissions by Term and Permission by field but none of these can perfectly fulfill my requirements. I am using Drupal 8 so some modules may not suitable for me.

Is there any solution for that?

  • Welcome to Drupal Answers! Questions cannot be changed, once they get answered, which means you cannot add new questions, or change the meaning of the original question. Strictly speaking, a question post is for asking a single question, not putting together different questions, even if the topic is the same. – kiamlaluno Oct 18 '17 at 9:52
1

You could use the Group module for this. This module allows any node to be "assigned" to some group. And then it depends how you configure the group roles (which are NOT the standard Drupal roles) about who has what kind of permissions.

For your case, create a group type named something like "Node Authors", and then create a "Group" for each user (using something containing the user's name as its label). And tune the permissions which come with the Group module (which are different from standard Drupal permissions!) to fit your needs.

After you enable gnode, a submodule of the Group module, you can assign any node to a group. In D7, you could simply do so at the node edit page: there is an extra form field on the node edit form which can be used to select the group that you want the node to be assigned to. However, in D8 this is no longer possible, for reasons explained in this comment, and which states:

... all content-to-group relationships are now fieldable and we therefore need to ensure the user is presented with the fields that were configured on said relationship. A simple auto-complete to select a group would therefore not work.

Therefor, in D8, this is what you have to do instead, as described also in the feature request "UI: more easily select group for a node":

  • Open the Groups list and click through it.
  • Select the appropriate Group.
  • Go to Group content.
  • Select "add group content".
  • Select which group content.

More info:

  • Can I ask one more question? So is it possible for one user to have different levels of permission among several nodes? For example, User A can edit node1 but can only view node2. Also, can I assign the node to a group at the node edit page? – wrigamer Oct 10 '17 at 2:21
  • Sorry to bother you again. But can you provide more details about the node-assigning process. I try to add a "Group" reference field at the content type form but it seems not working. – wrigamer Oct 11 '17 at 8:06
  • @wrigamer check my updated answer (to address your last question in your prior comment). – Pierre.Vriens Oct 12 '17 at 12:42
  • Yes indeed I have one more question about Group..Please check my updated question. – wrigamer Oct 18 '17 at 4:32
  • @wrigamer I suggest you post your update, as in revision 2of your question, as a new question. If you want, with a link to your question here (as a kind of followup question). Let me know (via an extra comment) after you did so ... – Pierre.Vriens Oct 18 '17 at 17:36

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.