Merge pull request #9695 from christianmg99/allow-oidc-roles-string

chg: [config] Allow Oidc roles as string
pull/9701/head
Jakub Onderka 2024-04-22 09:43:06 +02:00 committed by GitHub
commit 536bbb9d92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -443,12 +443,13 @@ class Oidc
} }
/** /**
* @param array $roles Role list provided by OIDC * @param array|string $roles Role list provided by OIDC
* @param string $mispUsername * @param string $mispUsername
* @return int|null Role ID or null if no role matches * @return int|null Role ID or null if no role matches
*/ */
private function getUserRole(array $roles, $mispUsername) private function getUserRole($roles, $mispUsername)
{ {
$roles = is_string($roles) ? explode($this->getConfig('roles_delimiter', ','), $roles) : $roles;
$this->log($mispUsername, 'Provided roles: ' . implode(', ', $roles)); $this->log($mispUsername, 'Provided roles: ' . implode(', ', $roles));
$roleMapper = $this->getConfig('role_mapper'); $roleMapper = $this->getConfig('role_mapper');
if (!is_array($roleMapper)) { if (!is_array($roleMapper)) {