How can I restrict my user from seeing certain content?

Scenario

Your database contains a list of all your customers and their annual sales figures. Your users need to be able to see the sales figures but you want to restrict who can see the company names to staff in your Finance department.

Solution

User Variables will allow you to change what each of them can see at an individual user level. In the following example, we added a CASE statement to the object in Data Connections that will display asterisks instead of the Customer Name when this object is used on the dashboard.

We then used a Variable for one user that will display the Customer Name in full when they use the same object on the dashboard.

Process

The steps below show how we achieved this:

Step1

At Object level in Data Connections we added a CASE statement that will hide all Customer Names. Once we’ve done this in the Data Connection we can then add a Variable at individual user level that will let certain users see the detail.

The following screenshot shows how we did this, we also added an Order by field for the Customer ID field.

The CASE statement that we added was CASE WHEN '[[OBFUSCATE]]'='No' THEN nr_customers.CUS_NAME ELSE '********' END

In this example, if OBFUSCATE is ‘No’ then all Customer Names will be displayed. However, if OBFUSCATE is ‘Yes’ then the asterisks will be displayed.

If you test this statement you’ll notice that the ‘Customer Name’ field has been aggregated, this is because ALL Customer Names are now displayed as asterisks by default.

To ensure a separate row is displayed for each Customer Name, we could add the Customer ID object to the ‘Order By’ field.

Step 2

We then added a Custom Variable on the Dashboard Configuration> Settings tab that will prevent all users from seeing the Customer Name.

The Variable of OBFUSCATE with the value of ‘Yes’ has been added.

Step 3

For all users that we want to see the Customer Name, we added a User Variable in the Data Configuration> Users screen..

In the following screenshot, you can see that we added the Variable of OBFUSCATE with the value of ‘No’ for an individual user.

When users with the User Variable of OBFUSCATE and value of ‘No’ log into the dashboard they will see full details.

When users with the Custom Variable of OBFUSCATE and value of ‘Yes’ log into the dashboard they will see the following.