Powered By GoodData - Apply Data Permissions

Related Tags: mandatory user filters quick start powered by data permissions

NOTE: This article is part of the Powered By GoodData Tutorial. Some aspects may not apply to other implementation scenarios.

After a Data Permissions filter has been defined within the project, you may assign it to the individual users within the project.

NOTE: Data Permissions were formerly called Mandatory User Filters.

Steps:

  1. Use the following API call to get the list of Data Permissions filters for the project:
    Type GET
    URI /gdc/md/{project-id}/query/userfilters
  2. In the JSON response, you should see an entry similar to the following:
                {
                    "link": "/gdc/md/{project-id}/obj/{filter-object-id}",
                    "author": "/gdc/account/profile/{user-id}",
                    "tags": "",
                    "created": "2012-01-16 11:08:13",
                    "deprecated": "0",
                    "summary": "",
                    "title": "User Filter Name",
                    "category": "userFilter",
                    "updated": "2012-01-16 11:08:13",
                    "contributor": "/gdc/account/profile/{user-id}"
                }
    
  3. In the JSON for that entry, the link value (/gdc/md/{project-id}/obj/{filter-object-id} in the above) provides the URI for the internal ID for the Data Permissions filter. Acquire this value.
  4. POST to the following API to apply the user filter to a specific user:
    Type POST
    URI /gdc/md/{project-id}/userfilters
  5. The JSON POST should be in the following format:
    { 
    "userFilters": {
            "items": [
                {
                    "user": "/gdc/account/profile/{user-id}",
                    "userFilters": [
                        "/gdc/md/{project-id}/obj/{user-filter-id}"
                    ]
                }
            ]
        }
    }
    
  6. In the response, a value corresponding to the user’s profile for the successful parameter indicates that the Data Permissions filter was applied to the user.
200 (OK)
    Content-Type: application/json
    
{
  "userFiltersUpdateResult": {
      "failed": [],
      "successful": [
           "/gdc/account/profile/PROFILE_ID"
        ]
    }
}

Data Permissions References