1

Context

  • Drupal 8
  • Switching to Drupal for intranet site in large organization

Background

OtraganixLocker Corporation is switching to Drupal from a custom-made home-grown intranet site. They want to use D8.

The problem is, the old custom-made intranet had the following permissions for (its equivalent of) D8 nodes:

  • add content
  • edit own content
  • edit any content
  • delete own content
  • delete any content
  • view own content
  • view any content

Moreover, the granularity of the permissions worked down to the "content-type" level on the old intranet.

Moreover, the granularity of the permissions on the old intranet permitted user-based-assignment as well as role-based-assignment.

Question

Drupal 8 seems to be missing the view own content and view any content permissions that the old intranet system had.

Moreover, there seem to be a lot of ways to handle this, at least in D7.

  • Is this missing functionality accounted for in D8 core and simply missing from the front-end interface, or is it also absent from D8 core?
  • If it is not absent from D8 core, which specific function or functions in the D8 API account for this functionality?

See also

  • Hi, your 2nd question needs to be asked on drupal.org as we don't engage in that sort of speculation here; as a Q+A site we're looking for questions with objective, definitive answers, rather than the more opinionated/discursive/ephemeral stuff. I'm struggling to understand what you mean by your first question, could you clarify what you're asking for? – Clive Jun 8 '16 at 12:44
  • //I'm struggling to understand what you mean by your first question, could you clarify what you're asking for?// Sure the question was blocked from modification by someone, so it was impossible to clarify. Now it looks like that block has been wisely revoked, so the question can now be updated. – dreftymac Jun 8 '16 at 16:36
  • @Clive: Hello, the question text has been clarified. If there are any further questions or comments, feel free to leave them here and they will be addressed at the earliest opportunity. Thanks for your participation on StackExchange. – dreftymac Jun 8 '16 at 16:40
  • Nope looks good to me, re-opened. Is there an implied 3rd part to the question too? Along the lines of "if it is absent from D8 core, how can I achieve it?" Or are you fact-finding rather than fixing? – Clive Jun 8 '16 at 16:49
  • //Or are you fact-finding rather than fixing?// Good point in asking this. The D8 Core API has numerous functions that can be used for this functionality, so much that it would be impossible to enumerate them all. For example, at this point a developer has to decide if she wants to use the Drupal hook_ system, or switch to the Symfony Event Model. The hook_ system is the most pervasive but is also not technically "object oriented" ... so there are trade-offs. You might say it is a question of both fact-finding and fixing, but it depends on numerous factors. – dreftymac Jun 8 '16 at 16:55
2

The node access control methods between Drupal 7 and Drupal 8 are largely the same and described in Node access rights. There are still the same hooks, just some of the plumbing is different.

So, if you want to implement the Drupal 6 fine grained access in Drupal 8, you can either do hook_node_access() or proper grants. Remember, node usage can exist in case other than the node pages (eg, lists); the node access system takes care of this. Work has begun on the ACL module and dependencies which provide some abstractions for these.

Drupal 8 also has a new concept for route access. It uses classes that implement AccessInterface, and then use YAML configuration for providing the requirements for the route. Looking at how routing is set up for the code node module (which defines the Node entity), may be the best starting point for delving into this, though it uses the same Access classes as the node acccess system. I think explaining it here may be too much.

  • 1
    Someone feel free to either correct or post a better answer in relation to AccessInterface; my memory is fuzzy here. – mpdonadio Jun 8 '16 at 17:33

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.