-
Notifications
You must be signed in to change notification settings - Fork 4
How can I define a new role?
A ROLE is a permission to access certain closed data. You can think of it as a group to which a user might belong to, to see more data.
Which data is available for a certain role is defined inside our Mobility API / ACL rules.
Per default all data is closed, if you want to make it an Open Dataset
, add to GUEST.sql
, otherwise add to the
different role definitions.
For example, if you would like to create a new role called LAIMBURG
, do the following:
- Go to Keycloak / Clients
- Open
odh-mobility-v2
- Then to "Roles > Add Role"
- Add a role prefixed with
BDP_
and a description for it:BDP_LAIMBURG
- Create a new file in Mobility API / ACL rules with name
LAIMBURG.sql
(all uppercase) - Add the filename to the list of rules inside
rules.txt
- Inside that file create an SQL statement which gets added to a SQL WHERE clause afterwards. Make sure to surround that statement with
(
and)
... see other files in that folder for some examples
Example for LAIMBURG.sql
:
-- Laimburg can see all data with origin = laimburg
(
s.origin = 'laimburg'
)
Hint: See our swagger specs to understand prefixes of query columns, here s
stands for station
for example
When you add a new Keycloak role, make sure that associated client roles allow them. This can be accomplished in two ways.
For example, if you want to activate the new BDP_LAIMBURG
role in https://analytics.opendatahub.com,
you need to do the following:
- Go to Keycloak / Clients
- Open
odh-mobility-analytics
- Then to "Scope", now you have two possibilities:
- Easier, but less secure:
- Allow
Full Scope Allowed
- Allow
- More work, but better security:
- Disable
Full Scope Allowed
- Go to
Client Roles
and search forodh-mobility-v2
- Enable all roles that you want to allow for this application
- Disable
- Finally, you need to repeat these steps for all clients that access
odh-mobility-v2
This wiki contains additional information about the Open Data Hub alongside the Open Data Hub - Official Documentation 🔗 .