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

Users from the "userNamesToIgnore" list removed from their groups #40

Open
vigen-b opened this issue Dec 22, 2023 · 2 comments
Open

Users from the "userNamesToIgnore" list removed from their groups #40

vigen-b opened this issue Dec 22, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@vigen-b
Copy link
Contributor

vigen-b commented Dec 22, 2023

Hello and thanks for the helpful tool.

I'm not sure, but it seems to be a bug. When I add a user to the userNamesToIgnore list, he is removed from all groups. A little debugging shows that ignored users are not skipped in the deployGitlabUsersAndGroups method.

Particularly ignored users are not skipped in this snippet.

$this->logger?->notice("Deleting extra group members...");
foreach ($userGroupMembersSync["found"] as $gitlabUserId => $gitlabUserName) {
if (isset($membersOfThisGroup[$gitlabUserId]) && $membersOfThisGroup[$gitlabUserId] == $gitlabUserName) {
continue;
}
$this->logger?->info(sprintf("Deleting user #%d \"%s\" from group #%d \"%s\" [%s].", $gitlabUserId, $gitlabUserName, $gitlabGroupId, $gitlabGroupName, $gitlabGroupPath));
$gitlabGroupMember = null;
/** @var GitlabGroupArray|null $gitlabUser */
!$this->dryRun ? ($gitlabGroup = $gitlab->groups()->removeMember($gitlabGroupId, $gitlabUserId)) : $this->logger?->warning("Operation skipped due to dry run.");
$userGroupMembersSync["extra"][$gitlabUserId] = $gitlabUserName;
$this->gitlabApiCoolDown();
}

@Adambean Adambean added the bug Something isn't working label Dec 22, 2023
@vigen-b
Copy link
Contributor Author

vigen-b commented Dec 25, 2023

@Adambean I tried to fix the bug. Can you take a look at the PR #41?

@Adambean
Copy link
Owner

Thanks for submitting a PR :) I'll look into this shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants