I have a question if it’s possible to update singl...
# gooddata-cn
I have a question if it’s possible to update single data source’s permissions through GoodData API? I can see that the API has an endpoint to fetch all data sources which seems to be the only endpoint that includes the permissions. Likewise, there is an endpoint to update all data sources at once: https://www.gooddata.com/developers/cloud-native/doc/cloud/manage-deployment/manage-permissions/set-permissions-for-data-source/ However, this endpoint doesn’t work unless I pass the data source credentials as well which makes it impossible to use for updating data. I’m planning to have multi-tenant setup where I have multiple workspaces and each of them has their own data source (separate DB schema). So I’m searching a way to setup the permissions for each data source separately.
Hi, I'm afraid it is currently not possible to manage permissions separately per data source. There's an internal feature request already, but we can't estimate when it will be implemented.
🎉 New note created.
For information, I have this exact same need, the existing API endpoints mentioned for this here don’t work as cleanly as it makes it sound: https://www.gooddata.com/developers/cloud-native/doc/cloud/manage-deployment/manage-permissions/set-permissions-for-data-source/ Even doing a a GET on
Copy code
then doing a PUT on the same endpoint with the exact data from the GET doesn’t work, it needs you to monkey around with the JSON file first. In my case it’s giving me this API output trying to PUT the output I just received via GET:
"detail": "Token value is required for BigQuery. DataSource: 1afe28f8-5be6-4a13-9c95-5ecdb6f50f0e",
"status": 400,
"title": "Bad Request",
"traceId": "c5096a29f1eef67a"
As both @Jani Siivola and I both have this kind of multi-tenant use case, we both have issues with needing to be able to manage this without all the issues that come from trying to push up the parts of the datasource config we don’t care about when trying to add permissions.
We plan to extend dataSource Layout API to separately manage permissions. In the meantime, you may simplify user permissions provisioning using GoodData Python SDK. Check https://www.gooddata.com/docs/python-sdk/docs/data/data-source/put_declarative_data_sources/ method that can be used to update the current data sources. Workflow can look like: 1. ds_list = get_declarative_data_sources() 2. update ds_list with proper permissions 3. put_declarative_data_sources(ds_list, file_with_credentials)
This workflow doesn’t work for me because step 1 doesn’t return the credentials/password (which is good) but the step 3 expects them to be there and gives validation error. Nevertheless, thank you for adding the new API methods to your roadmap. Happy to get that in use.