Question on the dashboard permissions API. I have...
# gooddata-cloud
k
Question on the dashboard permissions API. I have made some scripts that interact with the endpoints
/api/v1/actions/workspaces/<workspaceId>/analyticalDashboards/<dashboardId>/permissions
and
/api/v1/actions/workspaces/<workspaceId>/analyticalDashboards/<dashboardId>/managePermissions
. When getting an export of the former, I get an output like the below:
Copy code
{
  "userGroups": [],
  "users": []
}
Where the example here shows a format that looks like a list of assignee/permissions definitions. When making a new file in this style and POSTing it to the managePermissions endpoint, it does not like this format. There’s no example I can find of how the format above (userGroups and users with individual lists) should for formatted, so I am not sure how to proceed to make one that utilizes that format - does someone have a link to an API reference or an example of setting Dashboard view permissions via that managePermissions API endpoint?
j
@Kevin Taylor Hello Kevin. I suspect there’s a bug here, because what you’re trying to do should work. I’ve opened high-priority follow-up to look into this.
Hi Kevin. Small update. We’re in the process of pushing out a hotfix for this. Hopefully it’ll be today, but I’ll keep you updated.
After some further work, we’ve figured out that the issue is caused by a rare race condition that interferes with the JSON validation. Resolving this will take additional QA to make sure that the fix works as intended. I am afraid we cannot deliver the fix this week. At the moment, we are aiming for the next release window for GoodData Cloud on May 18th, but this is subject to prioritisation. Could you let me know how blocking the issue is for you at the moment? Additionally, there is a workaround. Steps are as follows: 1. Retreive the layout for your workspace using GET to endpoint /api/v1/layout/workspaces/{{workspace_id}}. This will produce a large JSON file. 2. Find the required dashboard using their ID. Each dashboard also has a permissions object. 3. Modify this object so that the userGroup you want to be able to see/edit the dashboard is included. Example using my dashboard titled Categories below: Before modification (note that I include only the permissions object here to make the post readable):
Copy code
...
"permissions": [
    {
        "assignee": {
            "id": "jan.rehanek",
            "type": "user"
        },
        "name": "EDIT"
    }
],
"title": "Categories"
```
After modification:
Copy code
"permissions": [
    {
        "assignee": {
            "id": "jan.rehanek",
            "type": "user"
        },
        "name": "EDIT"
    },
    {
        "assignee": {
            "id": "new_group_1",
            "type": "userGroup"
        },
        "name": "EDIT"
    }

],
"title": "Categories"
• Take the entire JSON output with this change and PUT it back to the same endpoint. This will grant the permissions as specified without having to rely on the currently impacted managePermissions endpoint.
k
Thanks for the update and workaround, @Jan Rehanek. I will give it a shot today.
👍 1
j
The layout API for the whole organization would also work, but I think it is not needed to take it that far — too much JSON to work through.
@Kevin Taylor This issue should now be patched with today’s release, which is already live.