I have overrided the UserAccessControlHandler class to fit my needs: some user can not be seen by some other users.

How to create a view listing only the users which can be "viewed" by the user looking at this view? [Could be nice to use UserAccessControlHandler::checkAccess to filter it]

I don't think that using hook_views_pre_render is good idea (pagination issue and it will be very slow), but maybe I am wrong or this is the only way.

Edit to add: This is a 'field' view displaying several fields of each user.

  • Maybe this module could work as a starter for your case drupal.org/project/reference_access – David Thomas Jun 14 '20 at 11:20
  • @Davis Thomas: I don't understand how this module will help me to filter view by access. As explained in the OP, I overrode UserAccessControlHandler which is what I could gain by using reference_access – Baud Jun 16 '20 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.