Skip to content

Commit 4f94cc1

Browse files
committed
mapping in config
1 parent f7f5e78 commit 4f94cc1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/UserBackend.php

+11-2
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,17 @@ public function updateAttributes($uid,
674674

675675
if ($newGroups !== null) {
676676
$prefix = '';
677-
if ($this->config->getAppValue('user_saml', 'unique_groups_per_idp', '0') === '1') {
678-
list(, $idp) = explode('@', $uid);
677+
$mapping = $this->config->getSystemValue('user_saml.unique_groups_per_idp', '');
678+
if ($mapping === '') {
679+
$mapping = $this->config->getAppValue('user_saml', 'unique_groups_per_idp', '');
680+
}
681+
682+
if ($mapping !== '' &&
683+
array_key_exists($mapping, $attributes) &&
684+
is_array($attributes[$mapping]) &&
685+
sizeof($attributes[$mapping]) === 1) {
686+
$realUid = $attributes[$mapping][0];
687+
list(, $idp) = explode('@', $realUid);
679688
$prefix = substr(md5($idp), 0, 7);
680689
$newGroups = array_map(
681690
function($g) use ($prefix) {

0 commit comments

Comments
 (0)