Failed to add permission to a SoftLayer user ID

旧街凉风 提交于 2019-12-04 06:19:30

问题


curl -D - -X POST -d @permissionSLUser.in.json -o "permissionSLUser.out.json"
"https://someuser:somepassword@api.softlayer.com/rest/v3/SoftLayer_User_Customer/1234/addPortalPermission.json"

permissionSLUser.in.json contains:

 { "parameters": [ { "key": "T_1" } ] }

permissionSLUser.out.json contains:

"error":"You may not add permissions that the parent does not possess to this account.","code":"SoftLayer_Exception_Public"

Update 1

I am certain that the parent of 1234 has T_1 permission, so I don't understand why I am getting this permission error.

Would anyone have any idea why? Thanks.


回答1:


Please use “keyname” instead of “key”.

This is a Rest Example:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[user_id]/addPortalPermission

Method: POST

Json:

{
  "parameters": [
    {
      "keyName": "TICKET_VIEW"
    }
  ]
}

To get all available permissions, please review: SoftLayer_User_Customer_CustomerPermission_Permission::getAllObjects

Update 1:

If you want to use SoftLayer_User_Customer::addBulkPortalPermission, please try the following REST request:

URL:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[User_Id]/addBulkPortalPermission

Method: POST

Json Payload:

{
  "parameters": [
    [
      {
        "keyName": "TICKET_VIEW"
      }
    ]
  ]
}

Note: In this case, notice that the configuration has 2 "square bracket": ...": [[{"keyName":...

I hope them help you.



来源:https://stackoverflow.com/questions/35798963/failed-to-add-permission-to-a-softlayer-user-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!