Skip to content

Commit

Permalink
add support for comma-separated groups in group mapping attribute
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc committed Dec 6, 2024
1 parent 138da66 commit c39164a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/Service/ProvisioningService.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,11 @@ public function getSyncGroupsOfToken(int $providerId, object $idTokenPayload) {
if ($event->hasValue() && $event->getValue() !== null) {
// casted to null if empty value
$groups = json_decode($event->getValue() ?? '');
// support values like group1,group2
if (is_string($groups)) {
$groups = explode(',', $groups);
$groups = array_filter($groups);
}
$syncGroups = [];

foreach ($groups as $k => $v) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/SettingsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
{{ t('user_oidc', 'Use group provisioning.') }}
</NcCheckboxRadioSwitch>
<p class="settings-hint">
{{ t('user_oidc', 'This will create and update the users groups depending on the groups claim in the id token. The Format of the groups claim value should be [{gid: "1", displayName: "group1"}, ...] or ["group1", "group2", ...]') }}
{{ t('user_oidc', 'This will create and update the users groups depending on the groups claim in the id token. The Format of the groups claim value should be [{gid: "1", displayName: "group1"}, ...] or ["group1", "group2", ...] or "group1,group2"') }}
</p>
<p>
<label for="group-whitelist-regex">{{ t('user_oidc', 'Group whitelist regex') }}</label>
Expand Down

0 comments on commit c39164a

Please sign in to comment.