Link Sub-Permissions

Last Updated on : 2023-10-09 08:08:53download

Based on the permission ID, link the specified permission with sub-permissions. Sub-permissions include resources and policies.

  • Note: Each permission can be linked with a maximum of 10 sub-permissions.

API address

POST: /v2.0/cloud/iam/permission/{permission_id}/item

Request parameter

Parameter nameTypeINRequiredDescription
permission_idLonguritrueThe ID of the specified permission.

Description of body

Parameter nameTypeINRequiredDescription
policy_idLong trueThe ID of the specified policy.
resource_idString trueThe ID of the specified resource.
resource_typeInteger trueThe type of the specified resource.
item_typeInteger falseThe type of the specified sub-permission. This field only takes effect on space resources. Valid values:
  • 1: The space contains subgroups.
  • 0: The space does not contain subgroups.

Return parameter

Parameter nameTypeDescription
successBooleanIndicates whether the operation is successful. Valid values:
  • true: The operation succeeded.
  • false: The operation failed.
error_codeStringThe error code. For more information, see the error codes.
error_msgStringThe message that is returned if the request fails. It is empty if the request is successful.
resultQueryResourceAndPolicyListByPermissionResThe returned result.

Description of result

Parameter nameTypeDescription
permission_idLongThe ID of the specified permission.
permission_item_listListThe list of sub-permissions.

Description of permission_item_list

Parameter nameTypeDescription
item_idLongThe ID of the specified sub-permission.
policy_idLongThe ID of the specified policy.
policy_nameStringThe name of the specified policy.
resource_idStringThe ID of the specified resource.
resource_typeIntegerThe type of the specified resource.
item_typeIntegerThe type of the specified sub-permission. This field only takes effect on space resources. Valid values:
  • 1: The space contains subgroups.
  • 0: The space does not contain subgroups.

Request example

POST: /v2.0/cloud/iam/permission/1/item
{
  "permission_item_list": [
    {
      "policy_id": "110001",
      "resource_id": "*",
      "resource_type": 11
    }
  ]
}

Return example

{
    "tid": "c7b8010c56b211ee801ef25dabf95fef",
    "result": {
        "role_id": 181044,
        "permission_list": [
            {
                "policy_id": 110001,
                "resource_type": 11,
                "permission_id": 232371810,
                "resource_id": "*"
            }
        ]
    },
    "t": 1695103635065,
    "success": true
}

Error code

For more information, see error code.