Remove User Roles¶
不登录 Application Portal 的状态下给用户移除角色。
操作权限¶
需要在 Application Portal 给应用授权“在本 OU 给用户授权”的权限。
请求格式¶
POST https://{apigw-address}/app-portal-service/v2.2/role/removeRoles
请求参数(Body)¶
名称 | 必需/可选 | 数据类型 | 描述 |
---|---|---|---|
organizationId | 必需 | String | 组织 ID。如何获取 organizationId 信息>> |
userId | 必需 | String | 用户 ID。 |
roleIds | 必需 | List | 要给用户移除的角色 ID。 |
响应参数¶
名称 | 数据类型 | 描述 |
---|---|---|
data | Boolean | true 表示移除成功,false 表示移除失败。 |
错误码¶
代码 | 描述 |
---|---|
31400 | 参数错误,长度错误,不能为空等 |
31403 | 应用未被授权“在本 OU 给用户授权”的权限 |
31404 | 未找到组织 |
示例¶
请求示例¶
url: https://{apigw-address}/app-portal-service/v2.2/role/removeRoles
method: POST
requestBody:
{"organizationId":"yourOrgId", "userId":"yourUserId","roleIds": ["role1","role2","role3"]}
返回示例¶
{
"code": 0,
"message": "OK",
"data": true
}
Java SDK 调用示例¶
public class AppPortalSdkTest{
@Test
public void removeUserRoles() {
ArrayList<String> roleIds = new ArrayList<>();
roleIds.add("role1");
RolesRemoveRequest rolesRemoveRequest = new RolesRemoveRequest("your_org_id", "your_user_id",roleIds);
Response response = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
.url("https://{apigw-address}").getResponse(rolesRemoveRequest, Response.class);
System.out.println("List organization res: " + JSON.toJSONString(response));
assertNotNull("Response should not be null", rolesRemoveRequest);
assertNotNull("Response data should not be null", response.data);
}
}