Skip to content

Publishing and permissions

Exercise publishing-and-permissions-annex.pdf · PDF

Quick question. Apart from you and your teacher, who has seen your Steam market dashboard?

Nobody. You built the KPI row, the tabs and the filters, and the whole thing still lives where only you can open it. That is a problem, because a dashboard is made to be read by someone else. A dashboard nobody can open is read by nobody, however good its charts are.

So in this lesson you change seats. You stop being the author and become the reader: you log in as a person with almost no rights, find out why they see nothing, and fix it one step at a time.

What you will learn

  • Publish a dashboard and say what Draft and Published really change
  • Name what the three roles Superset ships with (Admin, Alpha, Gamma) can do
  • Create a reader with the Gamma role and look at Superset through their eyes
  • Give a role access to one dataset, and explain why the dashboard then appears
  • Share a dashboard with a link, and explain why a link is not a permission
  • Avoid the trap: "I published it, so everyone can see it"

A game server with two locks

Think of a multiplayer game server. While the owner is still building the world, the server is private: only the owner and the admins get in. One day it opens. But even then, each player has a rank, and the rank decides which areas they may enter.

Superset works the same way. Between your dashboard and a reader there are two locks, and each one needs its own key:

Lock The question it asks In the game server The key
1 · Draft or Published Is this dashboard still being built? The server is private, or it is open The author publishes it
2 · Role and dataset Is this user allowed to read the data behind the charts? The player's rank lets them into this area, or not An admin gives one of the user's roles access to the dataset
flowchart LR
    R["<b>A reader</b><br>logged in to Superset"] --> L1{"<b>Lock 1</b><br>Is the dashboard<br>Published?"}
    L1 -- "No: Draft" --> X1["Not in their list"]
    L1 -- "Yes" --> L2{"<b>Lock 2</b><br>Does one of their roles<br>have access to the dataset?"}
    L2 -- "No" --> X2["Still not in their list"]
    L2 -- "Yes" --> OK["<b>They read the dashboard</b><br>and the filters work"]

We will keep the game server for the whole page. Remember the shape of the diagram: two questions, in that order.

Lock 1: Draft or Published

A draft dashboard is one that is still being built: only its owners and the admins can see it. A published dashboard is one the author has declared ready.

Open your Steam market dashboard and look next to its title. There is a small label: Draft. Superset's documentation is blunt about what it means:

"Draft dashboards are only visible to the dashboard owners and admins."

Click the label and it turns into Published. In the Dashboards list, the Status column changes too.

Who are the owners? The users who have permission to edit the dashboard. You are one, because you created it. An owner is the builder of that world; publishing is the moment the builder opens the server.

Careful: published does not mean public

The word is misleading. Published does not put your dashboard on the internet. It only means "no longer hidden as a draft". A reader still needs a Superset login, and still has to get past the second lock.

Lock 2: roles and datasets

A role is a named bundle of permissions. Every user has one or more roles, and a user can do exactly what their roles allow.

A permission is one single right: see this menu, read this dataset, edit that chart. Nobody hands out permissions one by one to each user: that would be endless. You put the permissions in a role, and you give the role to people. The role is the rank on the game server.

Superset ships with three main roles. Its documentation describes them like this:

Role In the game server What it can do
Admin The server admin Everything, including granting and revoking rights and changing other people's charts and dashboards
Alpha A trusted builder Sees all data sources and can add new ones, but only alters what it owns and cannot give rights to others
Gamma A player with a rank Only sees charts and dashboards made from data sources it has been given access to. Mostly a reader

On your own virtual machine you are Admin. That is why everything has always worked: an admin walks through every door. A real reader is usually Gamma.

Now the question that matters. A Gamma user, and a dashboard you have just published. Do they see it?

Not yet. Superset's documentation again:

"Published dashboards are visible to all users with access to the underlying datasets."

Read the last four words slowly. In Superset, permissions hang from the dataset, and the dashboard inherits them. Your Steam market dashboard is built on the dataset games_clean. A Gamma user with no access to games_clean cannot see any chart made from it, so they cannot see the dashboard either.

Published opens the first lock; access to the dataset opens the second.

Careful: you did not give access to the dashboard

When you give a role access to games_clean, you are not saying "this person may read Steam market". You are saying "this person may read everything built on games_clean": every chart, every dashboard, today and in the future. Before you open a dataset, think about what else uses it.

Does the database get a new user?

No. PostgreSQL does not know your readers exist. Superset talks to the database through the one connection you set up in Unit 1, Dades classe, and then decides by itself who is allowed to ask. Roles live in Superset, not in the database.

The least that lets them read

You could skip all of this and make every reader an Admin. The dashboard would appear at once. It would also let every reader delete every dashboard and read every dataset on the server.

Security people have a name for the right instinct, and it is older than you might think. In 1975, Jerome Saltzer and Michael Schroeder published a paper called The Protection of Information in Computer Systems. One of its design principles became famous as the principle of least privilege: every user should work with the smallest set of rights that lets them do their job, and nothing more.

For a dashboard reader, that smallest set is easy to write down:

The reader needs So you give them
To log in and open the dashboard pages The Gamma role
To read the data behind this dashboard One extra role with access to its dataset
Nothing else Nothing else

Gamma plus one role. That is the whole recipe, and it is what you will build now.

Try it: the reader's eyes

You need two browser windows. The normal one is you, the Admin. A private (incognito) window is the reader. A private window does not share your session, so it is how one person logs in as two users at the same time.

Work on your own VM, in order, and write down each result before you go on. The experiment only makes sense if you see every "no" before you fix it.

Step 1 — A reader who sees nothing. Check that Steam market still says Draft. Then create the reader:

Where Do this
Admin window Settings → List Users → + User
The form Username: viewer. Any first and last name. An invented email ending in .example. Roles: Gamma. A password you invent and write down
The form Tick Is active?. Unticked, the user exists but cannot log in
The form Save
Private window Open your Superset and log in as viewer
Private window Open Dashboards. Look at the top menus too

You should see an empty Dashboards list. Charts and Datasets are empty as well. And the menus are shorter: the SQL menu (with SQL Lab) is gone, and so are the Security entries under Settings. A Gamma user cannot even reach the screen where users are created.

Step 2 — Open the first lock. In the Admin window, open Steam market and click Draft → Published. In the private window, reload Dashboards.

Still empty. Do not fix anything yet: this is the most important moment of the lesson. The dashboard is published and the reader still does not see it. The first lock is open. The second is not.

Step 3 — Open the second lock. Now give the reader a rank that reaches the data:

Where Do this
Admin window Settings → List Roles → + Role. Role Name: Steam readers
The form In Permissions type games clean, with a space: this list shows every _ as a space
The form Choose the entry that starts with datasource access and names [Dades classe].[games clean]. Save
Admin window Settings → List Users → edit viewer → Roles: Gamma and Steam readers. Save
Private window Reload Dashboards, open Steam market, try a filter

Now the reader opens the dashboard. The KPI row reads 26,685 · 11.6% · 4.99 · 623, exactly as it does for you, and the filters work.

Those four numbers are not a coincidence. The reader's charts run the same query on the same data as yours:

SELECT COUNT(*), ROUND(100 * AVG(is_free::int), 1),
       PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY price),
       COUNT(*) FILTER (WHERE owners_tier = 'Hit')
FROM games_clean;
count round percentile_cont count
26685 11.6 4.99 623

A role decides whether you may read a dataset. It does not change what the dataset says.

Step 4 — A link is not a key. On the dashboard, in the Admin window: the three dots → Share → Copy permalink to clipboard. In the private window, log out and paste the link. Then log in again as viewer and paste it once more.

Logged out, the link sends you to the login page. Logged in as viewer, it opens the dashboard, with the filters exactly as they were when the link was copied. A permalink (permanent link) is an address that remembers the state of the dashboard. It carries no rights at all.

If something goes wrong
What you see What happened Fix
"Invalid login" for viewer Wrong password, or Is active? was left unticked List Users shows No under active: edit the user and tick it
viewer sees the dashboard already in Step 1 or 2 You are testing in the Admin window, or viewer was given Alpha or Admin Check the user name at the top right, and the user's Roles
viewer cannot open any page after Step 3 Gamma was replaced by Steam readers instead of added The user needs both: Steam readers alone has no right to open any page
The permission is not in the list You typed games_clean with the underscore Type games clean with a space and wait for the list
One chart shows an access error for viewer That chart uses another dataset Add that dataset's permission to Steam readers too

The four states

Put your notes side by side. This table is the whole lesson:

State Dashboard Roles of viewer Does viewer see it?
1 Draft Gamma No. Both locks closed
2 Published Gamma No. No access to games_clean
3 Published Gamma + Steam readers Yes, and the filters work
4 (the link) not logged in The login page. The link carries no rights

In state 2, where was the problem: in the dashboard or in the data? In the data. The dashboard was ready. The reader's rank did not reach the dataset.

Careful: Draft is not a security wall

If you switch a dashboard back to Draft, it disappears from the reader's list. But the role is untouched: the reader can still open the Charts list and see every chart built on games_clean, with its data. Draft hides the dashboard, not the data. To take data away from someone, you remove the dataset from their role.

One rule with no exceptions

A link shares a view. Passwords and API keys are never sent along with it, and never written on the dashboard itself: not in a chart, not in a note, not in a screenshot. If your project data came from an API, check that before you publish.

Key takeaways

  • A dashboard exists to be read by someone else. Between it and a reader there are two locks.
  • Lock 1 — Draft or Published. A draft is visible only to its owners (the users who may edit it) and to admins. Published means "no longer a draft", not "public on the internet".
  • Lock 2 — roles and datasets. A role is a bundle of permissions. Admin can do everything, Alpha sees all data but only alters what it owns, Gamma only sees what is built on datasets it was given.
  • Permissions hang from the dataset; the dashboard inherits them. Giving access to a dataset opens everything built on it.
  • Least privilege (Saltzer and Schroeder, 1975): give a reader the least that lets them read — Gamma plus one role.
  • A permalink is an address, not a key. And roles live in Superset: the database gets no new user.

Quick check

1. Who can see a dashboard that is still marked Draft?
  • Every user who has a Superset login
  • Its owners and the admins
  • Only the user who created it, not even admins
  • Anyone who has the link

A draft is the private server while the world is still being built: only the owners (the users who may edit the dashboard) and the admins get in. A link does not change that, because a link carries no rights.

2. You click Draft → Published. A colleague with only the Gamma role reloads their Dashboards list. What do they see?
  • The dashboard, because published dashboards are visible to everybody
  • The dashboard, but with empty charts
  • Still nothing, because none of their roles has access to the dataset behind the charts
  • An error message asking for the database password

Published opens only the first lock. Superset shows a published dashboard to users "with access to the underlying datasets", and a plain Gamma user has been given none. Two locks, two keys.

3. Which description matches the Alpha role?
  • It can do everything, including giving and removing other people's rights
  • It sees all data sources and can add new ones, but only alters what it owns and cannot grant rights
  • It only sees charts and dashboards built on data sources it has been given
  • It can only use SQL Lab

Alpha is the trusted builder: all the data, but no power over other people's work or rights. The first option is Admin; the third is Gamma.

4. You add the permission datasource access on games_clean to the role Steam readers. What have you really opened?
  • Only the Steam market dashboard
  • Only the charts in the KPI row
  • Every chart and dashboard built on games_clean, now and in the future
  • A new PostgreSQL account for each reader

Permissions hang from the dataset, and charts and dashboards inherit them. That is why you think about what else uses a dataset before you open it. And the database is not touched: roles live in Superset.

5. You copy the permalink of your published dashboard and send it to a friend who has no Superset user. What happens when they open it?
  • They see the dashboard, but cannot use the filters
  • They land on the login page
  • They see the dashboard with all the filters cleared
  • They become a Gamma user automatically

A permalink is an address that remembers the state of the dashboard. It is not a key: without a login and a role that reaches the dataset, it leads to the login page.

6. After adding the new role, your reader cannot open any page at all. What is the most likely mistake?
  • The dashboard went back to Draft
  • The reader's password expired
  • Gamma was replaced by the new role instead of being kept next to it
  • The dataset has too many rows for a Gamma user

The new role only holds one permission: read one dataset. The right to log in and open the dashboard pages comes from Gamma. The reader needs both roles.

7. A company dashboard uses two datasets: sales and salaries. The sales team must read the sales charts but must never see salaries. Pick the two statements that are true.
  • Giving the sales team a role with access to the sales dataset only keeps the salaries data closed to them
  • Leaving the dashboard in Draft is a safe way to protect the salaries
  • Making the whole sales team Admin is the simplest correct solution
  • The salary charts belong on a separate dashboard, for a role that does have access to the salaries dataset

Access is decided per dataset, so the split has to follow the datasets: one role per audience, and the charts each audience may not read on a dashboard of their own. Draft hides the dashboard, not the data, and an Admin can read every dataset: the opposite of least privilege.

Your dashboard now has readers. But what if those readers work somewhere that has never heard of Superset? Next: Reports with Power BI, where you rebuild three of your Steam charts in another tool and check that what you know still works.