security iam policy attach
Attaches an IAM policy to one or more identities.
You can use iam policy attach command to assign an IAM
Policy to identities, that is, users, groups, and/or roles.
You can run the iam policy attach command on a primary
cluster only.
Multiple type of identities (users, groups, roles) and number of identities (comma-separated names) can be specified in same command.
You cannot detach an identity policy that has the enforcing or the disarming status.
Syntax
- CLI
-
maprcli security iam policy attach -name <Policy Name> [ -users <List of Users> ] [ -groups <List of Groups> ] [ -roles <List of Roles> ]
- REST
-
Request Type POST Request URL http[s]://<host>:<port>/rest/iam/policy/attach?<parameters>
Parameters
| Parameter | Description |
|---|---|
name |
(Required) The name of the IAM policy. |
users |
(Optional) The list of users to which the policy is to be attached. To specify multiple users, use a comma-separated list of users. |
groups |
(Optional) The list of groups to which the policy is to be attached. to specify multiple groups, use a comma-separated list of groups. |
roles |
(Optional) The list of roles to which the policy is to be attached. |
Example
Attach IAM policy Policy1 to user user3
CLI
maprcli security iam policy attach -name Policy1 -users user3 -groups group2 -roles role1 -json
{
"timestamp":1726154305075,
"timeofday":"2024-09-12 08:18:25.075 GMT-0700 AM",
"status":"OK",
"total":0,
"data":[
],
"messages":[
"Identity Policy 'Policy1' attached successfully"
]
}RESTcurl -u <username> -X POST https://server.sj.us:8443/rest/security/iam/policy/attach?name=Policy1\&users=user3\&groups=group2\&roles=role1