
vShield API Programming Guide
24 VMware, Inc.
Role Management
Get Role for a User
Youcanretrieveinformationabouttheroleassignedtothisuser.
Example 2-23. Get user role
Request:
GET https://<vsm-ip>/api/2.0/services/usermgmt/role/<userId>
Possiblerolesaresuper_user,vshield_admin,enterprise_admin,security_admin,andauditor.
Add Role and Resources for a User
Youcanaddroleandaccessibleresourcesforthespecifieduser.ItaffectsonlyvCenterusers,notlocalusers.
ForlocalvShieldManagerusers,itdisplaystheerror“400:Useralreadypresent.”
Example 2-24. Update user role
RequestHeader:
POST https://<vsm-ip>/api/2.0/services/usermgmt/role/<userId>
RequestBody:
<accessControlEntry>
<role>new_role</role>
<resource>
<resourceId>resource-num</resourceId>
...
</resource>
</accessControlEntry>
ThisAPIreturns“204NoContent”ifsuccessful.
Change User Role
Youcanupdatetheroleassignmentforagivenuser.TheAPIreturnsanoutputrepresentationspecifyinga
new<accessControlEntry>fortheuser.
Example 2-25. Change user role
RequestHeader:
PUT https://<vsm-ip>/api/2.0/services/usermgmt/role/<userId>
RequestBody:
<accessControlEntry>
<role>new_role</role>
<resource>
<resourceId>resource-num</resourceId>
...
</resource>
</accessControlEntry>
Possiblerolesaresuper_user,vshield_admin,enterprise_admin,security_admin,andauditor.
Commentaires sur ces manuels