Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/Service/ProvisioningService.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,14 @@ 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);
// remove surrounding spaces in each group
$groups = array_map('trim', $groups);
// remove empty strings
$groups = array_filter($groups);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case there is any excess whitespace in the string, maybe it would also be a good idea to use trim/mb_trim to remove them.
wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it's now:

if (is_string($groups)) {
	$groups = explode(',', $groups);
	// remove surrounding spaces in each group
	$groups = array_map('trim', $groups);
	// remove empty strings
	$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
Loading