Data Entitlements Quickstart - BETA
This page shows you how to create a group of users named demo-users, add users to that group, and entitle that group to query all the data from the database in the insights-demo package.
If necessary, follow the instructions referred to in the Guided walkthrough for details on how to create and populate the insights-demo package.
Ensure you have met the prerequisites before using this quickstart.
To configure entitlements you need to either:
- have the Administrator role, or
- have the Maintainer role and own the package that contains the database.
Assuming you already have the insights-demo package deployed, do the following to configure entitlements.
Create a group and assign users
Note
To call the kxi user and kxi group CLI commands to manage users and groups, you need to provide credentials for a keycloak admin user as described here.
-
Use the following command to create the
insights-demogroup:kxi group create demo-users -
Assign groups to users:
-
For a new user you can add a group as part of the
kxi user createcommand:Replace the following variables with the appropriate values for your use case:kxi user create $USERNAME --password $PASSWORD --groups demo-users$USERNAME: Username to the assign group to.$PASSWORD: Password for the new user.
-
For an existing user, you can use the
kxi user assign-groupcommand to assign a group:kxi user assign-groups $USERNAME --groups demo-users$USERNAME: Username to the assign group to.
Note
Ensure the users you add to this group also have Viewer role because a user needs both role-based permissions and data entitlements for the
insights-demopackage to view data -
-
Ensure that each user has the Viewer role, at a minimum, as a user needs both role-based permissions and database entitlements to
insights-demoto view the data. Follow the guide here to modify the roles.
Configure the entitlements
-
Entitle the
demo-usersgroup to query the data in the database:-
Start an interactive session for entitlement management by calling the
kxi entitlement managecommand:kxi entitlement manage -
The session lists entities that can be entitled. Use the tab or the up and down arrows to select the record with EntityType of
databaseand Entity ofinsights-demoand press Enter. -
The session lists groups that can be entitled. Use the tab or the up and down arrows to select the demo-users group and press Enter.
-
The session lists access levels that you can assign to groups. Use the up and down arrows to select Read and press the spacebar to select Read access and press Enter to save the changes.
Note
Package entitlements are the only entitlements type that enforces the different access levels. For data entitlements, you must ensure at least one of them is selected.
-
The session displays a list of groups. The Access column is now set to
Rfor the "demo-users" group. -
Press Ctrl+B to go back to the list of entities.
-
Press Q to exit the interactive session.
-
Find the Group ID provided by Keycloak for the new "demo-users" group.
To do this, call the
kxi entitlement actorscommand:kxi entitlement actors[ { "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "name": "demo-users", "path": "/demo-users" }, ] -
Store the group ID defined in the id field to a variable called
$GROUPID. -
Find the entitlement for the
insights-demopackage usingkxi entitlement list.kxi entitlement list[ { "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "internalId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "entity": "insights-demo", "entityType": "database", "owner": { "id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "username": "ownername" }, "groups": [], "users": [] }, ] -
Store the entitlement ID defined in the "id" field to a variable called
$ID. -
Choose an access level and store it in a variable called
$ACCESS. The access levels available are defined here.Note
The package entitlements is the only entitlements type that enforces the different access levels. For data entitlements you just need to make sure at least one of them is selected.
-
Add the group to the query entitlements for the
insights-demopackage.kxi entitlement assign-groups $ID database $GROUPID:$ACCESS
-
Once these steps have been completed and a short period of time has been allowed for the synchronization of the change across the system, any user that is part of the demo-users group can now query data in the insights-demo database using REST, the Query window and Views.
Refer to the kdb Insights CLI documentation for full details on the kxi entitlement command and Entitlements fields for an explanation of the fields returned by the commands executed above.
Next steps
- Learn how to modify an entitlement in the configuration guide.
- Add Row level entitlements to further fine tune the data access.