Hide specific Report Pages for Groups or Roles

I recently had the request to hide a few pages of a tabbed report to a specific group of people. I guess there is – as usual – more than one way to handle this but I did it as follows:

Add a new data item to an existing query or create a new query with the following code:

sq(join('||',array(csvidentitynamelist())))

This will create a string of all groups and roles (basically everything you can see in your preferences under Groups and roles). Now you can create a report variable where you can test this expression for a speficic group. Lets say we added a new query and called it q_identities. The variable would contain something like:

[q_identities].[identities] like '%Group Xy%'

Add the query as a page query, set the element in the properties of your report and use the render variable you just created. If you already have a page query just add the data item there.

You are now able to maintain a list of users who are allowed (or not) to see a specific page of a report by editing the group.

Hope this quick and dirty approach may help anyone struggling with this – I am looking forward to hear other approaches!