I have browse pages created using a View based on indexed nodes in SOLR. I state it is a SOLR index because I've found many modules do not work well with SOLR indexing in exposing fields.
Every record is within a group using OG, and may be set to public or private access, as well as published/not published. Unfortunately, I've not found a nice way to filter results except by calling a custom function from within the View code itself, but when done there, the paging results are obviously not right because the results are already returned from the database. What I wish to do is create a filter, or a custom function to alter the query, but not sure if it is possible or quite how to go about it. What I wish to accomplish with the filter is:

1) If user is an Admin of the site, the filter will not apply.
2) If the record is private, and the user is in the group, then it will be shown in the list whether published or not.
3) If the record is private, and the user is NOT in the group, it will NOT be shown in the list whether published or not.
4) If the record is public, and the record is published, it shows to everyone regardless of group affiliation.

So what would be the best way to handle this? Can a filter like this be written? Or can I create a function in my module that intercepts the Views query and alters it accordingly? If someone could point me in the right direction and where to find information for what I need to script, it would be appreciated.

Comments

rbruhn’s picture

Status: Active » Closed (fixed)

Closing this as I think it is more relevant to Search API SOLR module.