Skip to content

Commit 9e19e04

Browse files
ArtificialOwlAndyScherzinger
authored andcommitted
mapping in config
1 parent 3f26043 commit 9e19e04

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
@@ -661,8 +661,17 @@ public function updateAttributes($uid,
661661

662662
if ($newGroups !== null) {
663663
$prefix = '';
664-
if ($this->config->getAppValue('user_saml', 'unique_groups_per_idp', '0') === '1') {
665-
list(, $idp) = explode('@', $uid);
664+
$mapping = $this->config->getSystemValue('user_saml.unique_groups_per_idp', '');
665+
if ($mapping === '') {
666+
$mapping = $this->config->getAppValue('user_saml', 'unique_groups_per_idp', '');
667+
}
668+
669+
if ($mapping !== '' &&
670+
array_key_exists($mapping, $attributes) &&
671+
is_array($attributes[$mapping]) &&
672+
sizeof($attributes[$mapping]) === 1) {
673+
$realUid = $attributes[$mapping][0];
674+
list(, $idp) = explode('@', $realUid);
666675
$prefix = substr(md5($idp), 0, 7);
667676
$newGroups = array_map(
668677
function($g) use ($prefix) {

0 commit comments

Comments
 (0)