1

There is a node form with a term reference field which's terms list I want to filter based on users/ permissions.

I've tried several modules in which I can grant access either user- or role-based for individual terms. Unfortunately, these settings are ignored by "Views: Filter by an entity reference view" when the views list is built.

So, whats the right way? How do I globally set per-term permissions that are also respected by views listings?

I've thought about changing the term controller but I don't see an access function there. Do I have to use a query alteration? Is there a hook?

1

You may want to try to add your own access checking in your view. A possible way to do so, is to use the Views Access Callback module, which you can yuse in a custom module to make your view perform whatever access check you want. Some more details about this Views Access Callback module (from its project page):

Provides callback-based access control for Views.

Available callback functions are defined by modules using hook_views_access_callbacks() function (in the same way as in hook_perm()), then could be set in in view's "Access restrictions" configuration.

The Community documentation for this module provides some extra details to get you going with this module.

  • thanks a lot, i will look into it. it will only provide access checks within views, right? – Alex Feb 19 '18 at 14:09
  • @Alex I think so ... – Pierre.Vriens Feb 19 '18 at 15:14
  • the module only provides a function to determine if the itself should be accessed, not single terms within the result set... – Alex Feb 20 '18 at 16:22
  • *if the view should be – Alex Feb 28 '18 at 10:03

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.