Remove User Groups

不登录 Application Portal 的状态下给用户移除用户组。

操作权限

需要在 Application Portal 给应用授权“在本 OU 给用户授权”的权限。

请求格式

POST https://{apigw-address}/app-portal-service/v2.2/userGroup/removeUserGroups

请求参数(Body)

名称 必需/可选 数据类型 描述
organizationId 必需 String 组织 ID。如何获取 organizationId 信息>>
userId 必需 String 用户 ID。
userGroupIds 必需 List 要给用户移除的用户组 ID。

响应参数

名称 数据类型 描述
data Boolean true 表示移除成功,false 表示移除失败。

错误码

代码 描述
31400 参数错误,长度错误,不能为空等
31403 应用未被授权“在本 OU 给用户授权”的权限
31404 未找到组织

示例

请求示例

url: https://{apigw-address}/app-portal-service/v2.2/userGroup/removeUserGroups

method: POST

requestBody:
{"organizationId":"yourOrgId", "userId":"yourUserId","userGroupIds": ["ug1","ug2","ug3"]}

返回示例

{
  "code": 0,
  "message": "OK",
  "data": true
}

Java SDK 调用示例

public class AppPortalSdkTest{
    @Test
    public void removeUserGroups() {
            ArrayList<String> userGroups = new ArrayList<>();
            userGroups.add("ug1");
            UserGroupsRemoveRequest userGroupsRemoveRequest = new UserGroupsRemoveRequest("your_org_id", "your_user_id",userGroups);
            Response response = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
                    .url("https://{apigw-address}").getResponse(userGroupsRemoveRequest, Response.class);

            System.out.println("List organization res: " + JSON.toJSONString(response));

            assertNotNull("Response should not be null", userGroupsRemoveRequest);
            assertNotNull("Response data should not be null", response.data);

    }
}