Everyone Sees Only Their Own Data: Row-Level Security with Session Variables

One dashboard, hundreds of users, and everyone sees only their own data. Here is how row-level security works in Vispeahen with session variables, step by step.

4 min read

/

June 20, 2026

/

Berna Ağababaoğlu

Snowy mountain landscape under a clear blue sky

Picture an organization with branches in all 81 provinces of Turkey. Headquarters wants to see the whole country, regional managers want their regions, and provincial managers want only their own province. This need comes up in almost every BI project, and it is usually solved in one of two wrong ways.

Wrong way one: build a separate copy of the dashboard for each region. For 81 provinces, that means 81 copies. Every change to a chart has to be made 81 times, and over time the copies drift apart.

Wrong way two: give everyone the same dashboard and ask them to “set the filter to your province”. That is not access control; it is a request. Anyone who clears the filter sees everything.

The right way is a single dashboard that automatically shows each user only the data they are authorized to see. This is called row-level security, and in Vispeahen you set it up with session variables.

What is a session variable?

A session variable is a value calculated for a specific user when they sign in, for example the answer to “which provinces can this user see?”

The value comes from an SQL query you define, usually reading from a permissions table. It is then bound to the filters on your dashboards. Users don’t see the filter and can’t change it; they simply see their own data.

An example: province-based access

Take an e-commerce company’s sales data. The organization keeps this permissions table:

User

Provinces they can see

Headquarters

All provinces

Metropolitan areas lead

İstanbul (34), İzmir (35), Ankara (06)

İstanbul provincial manager

İstanbul (34)

Ankara provincial manager

Ankara (06)

In Vispeahen, setup takes four steps:

1. Add the permissions table to the model. The table that maps users to provinces must be part of the data model.

2. Define the session variable. Give it a name, data type and default value; set when it runs, which connection it uses, and the SQL query that returns the signed-in user’s provinces.

3. Test the query. Make sure the right provinces come back for different users.

4. Bind the variable to filters. Bind it to a single analysis’s default filter, or to the whole dashboard at once through the Global Filter.

The result: when the İstanbul provincial manager opens the dashboard, they see only İstanbul’s sales, KPIs and trends. When headquarters opens the same dashboard, they see the whole country. There is still just one dashboard.


Not just provinces

The same approach works for access by region, branch, department, customer or product group. In a bank, branch managers see their branch; in a holding company, subsidiary managers see their company; in a public institution, regional directorates see their region.

Define once, apply everywhere

The biggest strength of session variables is consistency. A rule defined once applies the same way:

• on every dashboard,

• in reports,

• in the iOS and Android mobile apps.

With LDAP / Active Directory integration, users sign in with their existing corporate accounts; there is no new username and password to remember. When an employee moves to a new role, you update the permissions table, and you don’t touch the dashboards.

Why it matters

Row-level security is not only a security feature; it is a precondition for self-service analytics. If you want users to explore freely, you first need to define clearly what they can see. In Vispeahen, IT draws that line, and users filter and drill down as much as they like within it.

For a step-by-step setup, see the session variable guide on Learn Vispeahen (in Turkish). In the next post in this series, we will talk about paginated reports.