Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

groupApi removeMember remove subgroup and projects member #1137

Open
CHYhave opened this issue Jul 2, 2024 · 2 comments
Open

groupApi removeMember remove subgroup and projects member #1137

CHYhave opened this issue Jul 2, 2024 · 2 comments
Labels

Comments

@CHYhave
Copy link

CHYhave commented Jul 2, 2024

  1. add subgroup member
  2. add group member
  3. remove group member
    expect
    group member has been removed and keep subgroup member
    actual
    subgroup also has been removed
@CHYhave
Copy link
Author

CHYhave commented Jul 3, 2024

test case:
`
@test
public void removeMember() throws GitLabApiException, MalformedURLException {
Integer groupId = 3, userId = 2;
Integer subGroupId = 5;
GitLabApi gitLabApi = new GitLabApi("http://10.10.102.202:33200/", "glpat-mW-1QqaqTquBGdGt8UY6");
GroupApi groupApi = gitLabApi.getGroupApi();

    Member groupMember = groupApi.getOptionalMember(groupId, userId, true).orElse(null);
    if (groupMember == null) {
        groupApi.addMember(groupId, userId, AccessLevel.MAINTAINER);
        groupMember = groupApi.getOptionalMember(groupId, userId).orElse(null);
    }
    Assert.assertNotNull(groupMember);

    Member subGroupMember = groupApi.getOptionalMember(subGroupId, userId).orElse(null);
    if (subGroupMember == null) {
        groupApi.addMember(subGroupId, userId, AccessLevel.MAINTAINER);
        subGroupMember = groupApi.getOptionalMember(subGroupId, userId).orElse(null);
    }
    Assert.assertNotNull(subGroupMember);

    Group group = groupApi.getGroup(groupId);
    groupApi.removeMember(group.getId(), userId);
    groupMember = groupApi.getOptionalMember(groupId, userId).orElse(null);
    Assert.assertNull(groupMember);
    subGroupMember = groupApi.getOptionalMember(subGroupId, userId).orElse(null);
    Assert.assertNotNull("sub group member has been removed", subGroupMember);
}

`

@jmini
Copy link
Collaborator

jmini commented Aug 12, 2024

What you describes seems to be related to how GitLab itself works. I don't think we can influence this at client side.

@jmini jmini added the question label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants