Jump to content

Adding Access Control Entries to a Datasource with Seeq Data Lab


Recommended Posts

  • Seeq Team

There are instances where it's desirable to add or remove Access Control to a user created datasource.  For instance, you may want to push data from Seeq Datalab to a Datasource that is only available to a sub-set of users.  Below is a tip how to add additional entries to a Datasource Access Control List (ACL) using `spy.acl`.


1) Identify Datasource ID

If not already known, retrieve the ID for the Datasource.  This can be done via the Seeq REST API (accessible via the "hamburger" menu in the upper right corner of your browser window).  This is different from the datasourceId identifier and will contain a series of characters as shown below.  It can be retrieved via the `GET/datasources` endpoint under the `Datasources` section.


The response body will contain the ID:


2) Identify User and/or Group ID

We will also want to identify the User and/or Group ID.  Below is an example of how to retrieve a Group ID via the `UserGroups` GET/usergroups endpoint:


The response body will contain the ID:


3) Use `spy.acl()` to add group to the Datasource Access Control List (ACL)

  1. Launch a Seeq Datalab Project and create a new ipynb Notebook
  2. Assign the two IDs to a variable
  3. (Optional) - Check the current Access Control List for the Datasource using `spy.acl.pull()`
    current_access_control_df.iloc[0]['Access Control']
  4. Add the group_id to the Datasource ACL using `spy.acl.push()`
    spy.acl.push(datasource_id, {
        'ID': group_id,
        'Read': True,
        'Write': True,
        'Manage': False
    }, replace=False)

    Note I've set `replace=False`, which means the group will be appended to the current access list.  If the desire is to the replace the entire existing ACL list, this can be toggled to `replace=True`.  Similarly, you can adjust the read/write/manage permissions to fit your need.

    For more information on `spy.acl.push`, reference the `spy.acl.ipynb` document located in the SPy Documentation folder or access the docstring by executing

  5. (Optional) - To confirm the correct ID has been added, re-pull the ACL via `spy.acl.pull()`
    current_access_control_df.iloc[0]['Access Control']



Edited by Patrick
added code
  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...