Skip to content

Commit

Permalink
Fixed duplicate group member adds for users already in the group.
Browse files Browse the repository at this point in the history
Done some tweaks to the update group members bit, even though it's not used.
  • Loading branch information
Adambean committed Dec 25, 2018
1 parent b64545e commit 5a053c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/LdapSyncCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ private function deployGitlabUsersAndGroups(array $config, string $gitlabInstanc
// Add missing group members
$this->logger->notice("Adding missing group members...");
foreach ($membersOfThisGroup as $gitlabUserId => $gitlabUserName) {
if ($this->in_array_i($gitlabUserId, $userGroupMembersSync["found"])) {
if (isset($userGroupMembersSync["found"][$gitlabUserId]) && $userGroupMembersSync["found"][$gitlabUserId] == $gitlabUserName) {
continue;
}

Expand Down Expand Up @@ -1463,11 +1463,11 @@ private function deployGitlabUsersAndGroups(array $config, string $gitlabInstanc
asort($userGroupMembersSync["extra"]);
$this->logger->notice(sprintf("%d Gitlab group \"%s\" [%s] member(s) deleted.", $userGroupMembersSync["extraNum"] = count($userGroupMembersSync["extra"]), $gitlabGroupName, $gitlabGroupPath));

/* This isn't needed...
// Update existing group members
/* This isn't needed...
$this->logger->notice("Updating existing group members...");
foreach ($userGroupMembersSync["found"] as $gitlabGroupId => $gitlabGroupName) {
if ((isset($userGroupMembersSync["new"][$gitlabGroupId]) && is_array($userGroupMembersSync["new"][$gitlabGroupId])) || (isset($userGroupMembersSync["extra"][$gitlabGroupId]) && is_array($userGroupMembersSync["extra"][$gitlabGroupId]))) {
foreach ($userGroupMembersSync["found"] as $gitlabUserId => $gitlabUserName) {
if ((isset($userUserMembersSync["new"][$gitlabUserId]) && $userUserMembersSync["new"][$gitlabUserId]) == $gitlabUserName || (isset($userUserMembersSync["extra"][$gitlabUserId]) && $userUserMembersSync["extra"][$gitlabUserId] == $gitlabUserName)) {
continue;
}
Expand Down

0 comments on commit 5a053c9

Please sign in to comment.