Hi, on GD Cloud, I can invite a user but will be a...
# gooddata-cn
m
Hi, on GD Cloud, I can invite a user but will be an admin. Only thing they can do once the dashboard is embedded in React with GD UI is “Save as new”. Is there a way to make that user, read/view only. On GD Platform, that’s simple role change from the GUI. How can I do that in GD Cloud?
Unfortunately, sending a PUT request on <http:///api/v1/layout/workspaces/samsonite-arygh/permissions|/api/v1/layout/workspaces/samsonite-arygh/permissions> did not work. { “hierarchyPermissions”: [], “permissions”: [ { “assignee”: { “id”: “e74035f6-e1d2-49ca-8e1a-0f319314daec”, “type”: “user” }, “name”: “VIEW” } ] } I can do this const config = { isReadOnly: true }; … <Dashboard dashboard={dashboard} config={config} /> But, potentially user can find the GoodData login page and break everything
p
Hi @Michael Serres, just remove the user from the
adminGroup
. Follow the next cURL commands to do so: • first, GET the user with its user groups
Copy code
curl -H "Authorization: Bearer $YOUR_API_TOKEN" https://<your-domain>.<http://cloud.gooddata.com/api/v1/entities/users/e74035f6-e1d2-49ca-8e1a-0f319314daec?include=userGroups|cloud.gooddata.com/api/v1/entities/users/e74035f6-e1d2-49ca-8e1a-0f319314daec?include=userGroups>
• you’ll get something like this
Copy code
{
    "data": {
        "id": "e74035f6-e1d2-49ca-8e1a-0f319314daec",
        "type": "user",
        "attributes": {
            "authenticationId": "<users-authentication-id>" !!! needs to be copied to the next request
        },
        "relationships": {
            "userGroups": {
                "data": [{
                    "id": "adminGroup", !!! this group needs to be removed
                    "type": "userGroup"
                }]            }
        }
    },
    "included": [...], # not needed for the next request
    "links": {...} # not needed for the next request
}
• call the PUT for the particular user
Copy code
curl -X PUT \
     -H "Authorization: Bearer $YOUR_API_TOKEN" \
     -H "Content-Type: application/vnd.gooddata.api+json" \
     -d "@data.json" \
     https://<your-domain>.<http://cloud.gooddata.com/api/v1/entities/users/e74035f6-e1d2-49ca-8e1a-0f319314daec|cloud.gooddata.com/api/v1/entities/users/e74035f6-e1d2-49ca-8e1a-0f319314daec>
• … where
data.json
will contain following body
Copy code
{
    "data": {
        "id": "e74035f6-e1d2-49ca-8e1a-0f319314daec",
        "type": "user",
        "attributes": {
            "authenticationId": "<users-authentication-id>" !!! copied from previous request
        },
        "relationships": {
            "userGroups": {
                "data": []
            }
        }
    }
}
Please, do not forget to copy and paste the
authenticationId
field into the PUT request, otherwise the user will not be able login to the GD Cloud platform.
Sorry for inconveniences, we will try to improve this experience soon.
m
Nice, thank you very much @Peter Plochan