Skip to content

Commit

Permalink
add possibility of adding custom,static groups
Browse files Browse the repository at this point in the history
  • Loading branch information
cupcakearmy authored and fguillot committed Mar 1, 2023
1 parent 84a986a commit 37e89f1
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions User/GenericOAuth2UserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,23 @@ public function getExternalGroupIds()
{
$key = 'oauth2_key_groups';

$filteredGroups = array();

// Fixed custom groups
$custom_groups = array();
$custom_groups_raw = $this->configModel->get('oauth2_custom_group');
if (!empty($custom_groups_raw)) {
$custom_groups = explode(',', $custom_groups_raw);
$custom_groups = array_map('trim', $custom_groups);
}
foreach ($custom_groups as $group) {
$this->groupModel->getOrCreateExternalGroupId($group, $group);
array_push($filteredGroups, $group);
}


if (empty($this->configModel->get($key))) {
return array();
return $filteredGroups;
}

$groups = $this->getKey($key);
Expand All @@ -194,7 +209,6 @@ public function getExternalGroupIds()
$groups = array_unique($groups);
$this->logger->debug('OAuth2: '.$this->getUsername().' groups are '. join(',', $groups));

$filteredGroups = array();
$groupFilter = array();

$confGroupFilter = $this->configModel->get('oauth2_key_group_filter');
Expand Down

0 comments on commit 37e89f1

Please sign in to comment.