How to :: validate your user’s rights with View As

In this case, you’ve chosen to keep data in your own information system and connect to Toucan through Live Data. You are responsible of the user rights over your data and you’re using the user attributes in order to authenticate your users on your API or your analytics database.

Now that you’ve created a few stories, you want to see how they render according to several different user attributes. For that, we offer a tool in our Studio called the View as.

Story configuration

Let’s say we’ve got a story that displays performance for several stores in different cities. We’re happy with this visualization but we want it to be filtered by city according to the current authenticated user.

In my user’s attributes, we’ve got a store attributes that tells us which store data the user can see.

Let’s edit our query to do so. In our Visual Query Builder, we want to filter our Label column according to the dynamic variable that will be passed in my authentication token.

Label Filter Variables

Label Filter Variables

Let’s then insert our store variable.

User Attributes Templating

User Attributes Templating

Tip

The __VOID__ variable allows us to ignore that filter if store attribute is missing!

View As

View As

View As

We will create a “Custom User”.

view as custom user
Custom user popup

Custom user popup

We can write our custom user’s attributes store in the popup.

Custom user detroit

Custom user detroit

Applying this value, we can preview the story as if we were authenticated with store equal to Store Detroit.

Filter by detroit

Filter by detroit