Distribute Analytics To Users

If you have multiple users who want to use analytics, and you want them to access only the entities and data they are entitled to access, you can do it with GoodData multitenancy.

How does it work?

A company can be represented as a tree consisting of multiple departments. All departments share data and metrics. Moreover, each department has its own data and metrics as well. You can easily replicate the structure in GoodData by using workspace hierarchy and data filters.

Company and Departments

Parent workspace represents the whole company and contains shared logical data model, metrics, visualizations and dashboards. Each department is then represented as a child workspace, which inherits analytical objects from parent workspace. Users in child workspaces can use inherited objects or build their own.

Workspace hierarchy

Steps:

  1. Create a Parent Workspace.

    The parent workspace is shared with child workspaces in ready-only mode. Once the parent workspace gets a new entity (for example, new data source), it becomes available to its child workspaces.

    UI
    API

    To create a parent workspace, open the Workspaces tab and click Create Workspace.

    List of Workspaces

    Once the workspace is created, click its row in the list to open the workspace details. There, you can connect data, manage users, create a child workspace etc.

    Edit Workspace Dropdown Menu
    Bash
    PowerShell 7
    curl -H "Authorization: Bearer <API_TOKEN>" \
      -H "Content-Type: application/vnd.gooddata.api+json" \
      -H "Accept: application/vnd.gooddata.api+json" \
      -X POST \
      -d '
    {
      "data": {
        "id": "headquarters",
        "type": "workspace",
        "attributes": {
          "description": "My parent workspace.",
          "name": "Headquarters"
        }
      }
    }
      ' $HOST_URL/api/v1/entities/workspaces
    
    Invoke-RestMethod -Method Post -Uri "$HOST_URL/api/v1/entities/workspaces" `
      -ContentType 'application/vnd.gooddata.api+json' `
       -H @{ 
         'Accept' = 'application/vnd.gooddata.api+json'
         'Authorization' = "Bearer <API_TOKEN>" 
       } `
       -Body '
    {
      "data": {
        "id": "headquarters",
        "type": "workspace",
        "attributes": {
          "description": "My parent workspace.",
          "name": "Headquarters"
        }
      }
    }'
    
  2. Create Child Workspaces.

    UI
    API

    To create a child workspace, open the Workspaces tab and click the parent workspace, i.e. the one that the child workspace should be related to.

    Create a Child Workspace

    In the parent workspace details, click Create child workspace and fill in its details. You can also see the list of all the child workspaces related to this specific parent workspace.

    Bash
    PowerShell 7
    curl -H "Authorization: Bearer <API_TOKEN>" \
      -H "Content-Type: application/vnd.gooddata.api+json" \
      -H "Accept: application/vnd.gooddata.api+json" \
      -X POST \
      -d '
    {
      "data": {
        "id": "subs1",
        "type": "workspace",
        "attributes": {
          "description": "My child workspace.",
          "name": "Subsidiary I."
        },
        "relationships": {
          "parent": {
            "data": {
              "id": "headquarters",
              "type": "workspace"
            }
          }
        }
      }
    }
      ' $HOST_URL/api/v1/entities/workspaces
    
    Invoke-RestMethod -Method Post -Uri "$HOST_URL/api/v1/entities/workspaces" `
      -ContentType 'application/vnd.gooddata.api+json' `
       -H @{ 
         'Accept' = 'application/vnd.gooddata.api+json'
         'Authorization' = "Bearer <API_TOKEN>" 
       } `
       -Body '
    {
      "data": {
        "id": "subs1",
        "type": "workspace",
        "attributes": {
          "description": "My child workspace.",
          "name": "Subsidiary I."
        },
        "relationships": {
          "parent": {
            "data": {
              "id": "headquarters",
              "type": "workspace"
            }
          }
        }
      }
    }'
    
  3. Create a JSON document with filter definitions.

    Use the following template to create a JSON document that describes the data filters that you want to apply:

    {
      "workspaceDataFilters": [
        {
          "id": "<data-filter-id>",
          "title": "<data-filter-name>",
          "columnName": "<column-name>",
          "workspace": {
            "id": "<parent-workspace-id>",
            "type": "workspace"
          },
          "workspaceDataFilterSettings": [
            {
              "id": "<data-filter-condition-id>",
              "title": "<data-filter-condition-name>",
              "filterValues": [
                "<filter-value>"
              ],
              "workspace": {
                "id": "<child-workspace-id>",
                "type": "workspace"
              }
            }
          ]
        }
      ]
    }
    
    • <data-filter-id> is the unique ID of the data filter.
    • <data-filter-name> is the UI-friendly name of the data filter.
    • <column name> is the name of the column in a connected data source that holds the values to be compared to the filter value specified in the <filter-value> parameter.
    • <parent-workspace-id> is the ID of the parent workspace for whose child workspaces you are setting up the data filters.
    • <data-filter-condition-id> is the unique ID of the data filter condition for a specific child workspace.
    • <data-filter-condition-name> is the UI-friendly name of the data filter condition.
    • <filter-value> is one or more filter values that act as a condition for distinguishing whether the data should be available in the child workspace.
    • <child-workspace-id> is the ID of the child workspace that the data filter with the specified condition is applied to.

    Example: A sample JSON document that describes the data filters for the scenario described earlier.

    {
      "workspaceDataFilters": [
        {
          "id": "region",
          "title": "Customer Region",
          "columnName": "wdf__region",
          "workspace": {
            "id": "headoffice",
            "type": "workspace"
          },
          "workspaceDataFilterSettings": [
            {
              "id": "region_west",
              "title": "Western States",
              "filterValues": [
                "West"
              ],
              "workspace": {
                "id": "western",
                "type": "workspace"
              }
            }
          ]
        },
        {
          "id": "state",
          "title": "Customer State",
          "columnName": "wdf__state",
          "workspace": {
            "id": "western",
            "type": "workspace"
          },
          "workspaceDataFilterSettings": [
            {
              "id": "state_california",
              "title": "California",
              "filterValues": [
                "California"
              ],
              "workspace": {
                "id": "california",
                "type": "workspace"
              }
            }
          ]
        }
      ]
    }
    
  4. Upload the JSON document.

    Bash
    PowerShell 7
    curl -H "Authorization: Bearer <API_TOKEN>" -X PUT \
     $HOST_URL/api/v1/entities/workspaces/subs1?include=workspaces
    
    Invoke-RestMethod -Method PUT -Uri "$HOST_URL/api/v1/entities/workspaces/subs1?include=workspaces" `
       -H @{ 'Authorization' = "Bearer <API_TOKEN>" }