Created on 09-08-2017 07:14 AM - edited 09-16-2022 05:12 AM
I am executing this curl command ,When I provide files view to a particular user, then in files views, only that user persisted and other users get deleted.
admin-> manage amabri -> views > files : here I find only user whom i given access with this curl command but users those were earlier there got deleted
curl -i -u $Ambariadmin:$ambaripass -H "X-Requested-By: ambari" -X PUT -d '[{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"'$username'","principal_type":"USER"}}]' http://localhost:8080/api/v1/views/$viewname/versions/$version/instances/$instance/privileges
Created 09-08-2017 07:38 AM
- You will need to pass all the previous user privilege details as well along with the new user when you want to edit the list using API call:
Example if you already have users privilleges for "123jay", "jay". Now you want to add another user "jayyarn" in the privilleges list then you should PUT the whole list again.
Example:
curl -i -u $Ambariadmin:$ambaripass -H "X-Requested-By: ambari" -X PUT -d '[{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"123jay","principal_type":"USER"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"jay","principal_type":"USER"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"jayyarn","principal_type":"USER"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"CLUSTER.ADMINISTRATOR","principal_type":"ROLE"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"CLUSTER.OPERATOR","principal_type":"ROLE"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"SERVICE.OPERATOR","principal_type":"ROLE"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"SERVICE.ADMINISTRATOR","principal_type":"ROLE"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"CLUSTER.USER","principal_type":"ROLE"}}]' http://localhost:8080/api/v1/views/$viewname/versions/$version/instances/$instance/privileges
.
Created 09-08-2017 07:15 AM
@Jay SenSharma could you pls look into issue
Created 09-08-2017 07:38 AM
- You will need to pass all the previous user privilege details as well along with the new user when you want to edit the list using API call:
Example if you already have users privilleges for "123jay", "jay". Now you want to add another user "jayyarn" in the privilleges list then you should PUT the whole list again.
Example:
curl -i -u $Ambariadmin:$ambaripass -H "X-Requested-By: ambari" -X PUT -d '[{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"123jay","principal_type":"USER"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"jay","principal_type":"USER"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"jayyarn","principal_type":"USER"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"CLUSTER.ADMINISTRATOR","principal_type":"ROLE"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"CLUSTER.OPERATOR","principal_type":"ROLE"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"SERVICE.OPERATOR","principal_type":"ROLE"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"SERVICE.ADMINISTRATOR","principal_type":"ROLE"}},{"PrivilegeInfo":{"permission_name":"VIEW.USER","principal_name":"CLUSTER.USER","principal_type":"ROLE"}}]' http://localhost:8080/api/v1/views/$viewname/versions/$version/instances/$instance/privileges
.