1

I'm using Drupal 9

I would like users to be able to allow other users to view their node content. Ideally a user will request access to view the content and the content owner will grant them view access. How would I go about that?

I've looked at Nodeaccess, but it doesn't seem ready for Drupal 9 yet. Node access user reference has nothing close for Drupal 9

3
  • 1
    Welp, use D8 then.
    – No Sssweat
    Aug 28, 2020 at 4:22
  • Will D8 allow me to do what I want?
    – dca123
    Aug 28, 2020 at 4:23
  • Nodeaccess is available for D8, so yes.
    – No Sssweat
    Aug 28, 2020 at 4:25

2 Answers 2

3

You can do it using a small custom module.

  1. Make a allowed users/node list (database table oe entity)
  2. Implement hook_entity_access()
  3. return AccessResult::allowed() or AccessResult::forbidden() according to your user/node table
1
  • I am considering creating a module just for this. Do you have a suggestion for how to create the request to view a node?
    – dca123
    Aug 28, 2020 at 15:02
0

If I understand your question well, you could maybe use also the Group module. It permits you to create groups of entities, that can be visible only by the user roles that has access to a certain group. Also, the roles in groups can be different from the Drupal Roles. So, for each group you can create a moderator role, that can decide the visible content for each one of the other roles of the group.

Regards

3
  • Do you have a suggestion about how to create the request to view a node? Or does Group module do that?
    – dca123
    Aug 28, 2020 at 15:04
  • You can create a new group and after go to tab 'Nodes' and add the entities you want to be accessible for that group.
    – iomack
    Aug 28, 2020 at 15:08
  • That sounds like a viable option. Thanks!
    – dca123
    Aug 28, 2020 at 16:50

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.