I have a Drupal website which uses webforms and a custom module to manage the access in their submissions using hook_webform_submission_access
.
While successfully restricting the access of a webform submission to a user, though, when they view the "Results" tab (or the "Table) the access filter isn't triggered as these tables are generated by Views.
How can I add a filter to the default "Webform submissions" view in order not to show the ones that the user has no access on?
PS: I know I can use hook_views_pre_render
and unset the rows from the results, but I believe a filter would be a better and more elegant solution.
hook_webform_submission_access
, it checks some user data with the submission data and returns TRUE/FALSE. Potentially I could replicate the logic but I'd like to ask the view to check whether the user has general access to the submission.