Skip to content

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

@vigen-b

Description

@vigen-b

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();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions