Skip to content

Commit 28451fd

Browse files
committed
Fixed fatal error when coming across a sub-group.
This doesn't fix sub-group handling, it just ignores them and carries on. #6
1 parent b919d1e commit 28451fd

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Features implemented:
2020
* Synchronising groups to Gitlab
2121
* Synchronising Gitlab group memberships based on LDAP group memberships
2222

23+
Not implemented:
24+
25+
* Sub-group handling
26+
2327
If in doubt use the dry run `-d` option to prevent writing to Gitlab first, combined with `-vv` to see exactly what would happen.
2428

2529
**You have been warned!**

src/LdapSyncCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,11 @@ private function deployGitlabUsersAndGroups(array $config, string $gitlabInstanc
13591359

13601360
$membersOfThisGroup = [];
13611361
foreach ($usersToSyncMembership as $gitlabUserId => $gitlabUserName) {
1362+
if (!isset($ldapGroupsSafe[$gitlabGroupName]) || !is_array($ldapGroupsSafe[$gitlabGroupName])) {
1363+
$this->logger->warning(sprintf("Group \"%s\" doesn't appear to exist at path \"%s\". (Is this a sub-group? Sub-groups are not supported yet.)", $gitlabGroupName, $gitlabGroupPath));
1364+
continue;
1365+
}
1366+
13621367
if (!$this->in_array_i($gitlabUserName, $ldapGroupsSafe[$gitlabGroupName])) {
13631368
continue;
13641369
}

0 commit comments

Comments
 (0)