3

Asked this question on Drupal.org also, but i think this place is going faster and better :-)

I've installed Content Access and made a view for a Content Type. In the table, users can see content only for them. An admin is giving the rights to view, edit and delete content.

Is it possible to show to users who else has access to a node?

0

You've tagged the question with Views. Are you asking whether it's possible to build a View to do that? If so, then the answer is no (unless there's some module or plug-in out there which would add that capability).

Views queries the database, but node access permissions can be set in code via hook_node_access(). It's totally possible, for example to write some code that grants a user access to a specific node only if they have the letter 'x' in their name and today is Monday.

You can of course do it with some PHP code, and you could hook that into a View using Views hooks. I'm not sure what the most efficient approach would be, but basically:

  • Use hook_views_post_execute to process the list of nodes returned by your View.
  • For each node in your View result, you would need to loop through all users, calling node_access() to test if that user (uid) had access to the node or not.
  • From the results, build a list of users who had access, and have Views display that list by modifying the $view object that was passed to your hook function.

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.