Topic: How to allow filtering for both logged-in and anonymous users
Hi,
I'm trying to get something right in an Indicia report (page category=reporting; page type=reporting page (customisable)).
A logged-in user sees the Filter Bar but an anonymous user doesn't. Based on a previous question this seems to be expected behaviour: https://forums.nbn.org.uk/viewtopic.php?id=7024 where Jim said
I can see this is the intended behaviour from client_helpers/prebuilt_forms/dynamic_report_explorer.php get_control_standardparams().
I want to restrict the report's map and grid to records that have not been rejected or are dubious.
If I specify a parameter such as @quality=!D in the Form Structure of the User Interface under [standard_params], it correctly filters out dubious and rejected records for logged in users. For the logged-in user the filter states 'Quality. Exclude not accepted records' and changing this to e.g. 'All records' makes rejected records appear as I would expect. Great. However for the anonymous user the report loads with all records visible, even rejected/dubious ones, and there is no filter bar so they cannot interogate the records based on status.
I tried another approach (from https://indicia-docs.readthedocs.io/en/ … ing.html). Instead of specifying a parameter in the form structure I added it in the report's xml files by adding a condition to the query like this:
and quality_check('#quality#', o.record_status, o.certainty)=true
and a parameter like this:
<param name="quality" display="Data quality" datatype="lookup" default='!D'
description="Quality level required of data to be included in the map."
lookup_values="V:Data must be verified,C:Data must be verified or certain,
L:Data must be at least likely,!D:Include anything not dubious or rejected,
!R:Include anything not rejected" />
Running that report as a logged-in user restricts records as it should but changing the Quality option in the filter bar e.g. to 'All records' does not make rejected records appear. Running it as an anonymous user shows the records filtered correctly.
So - how can I get this to work for both logged-in and anonymous users correctly so that records are always initially restricted but can be queried using the filter bar. (Or - is there a way to make the filter bar available to anonymous users?)
Thanks for any advice.