Skip to content
Open
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: 7 additions & 1 deletion lib/UserDiscoveryModules/ManualUserMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ManualUserMapping implements IUserDiscoveryModule {
private string $idpParameter;
private string $file;
private bool $useRegularExpressions;
private bool $normalizedKey;

public function __construct(
IConfig $config,
Expand All @@ -53,6 +54,7 @@ public function __construct(
$this->idpParameter = $config->getSystemValueString('gss.discovery.manual.mapping.parameter', '');
$this->file = $config->getSystemValueString('gss.discovery.manual.mapping.file', '');
$this->useRegularExpressions = $config->getSystemValueBool('gss.discovery.manual.mapping.regex', false);
$this->normalizedKey = $config->getSystemValueBool('gss.discovery.manual.mapping.regex.normalized', true);

$this->logger->debug('Init ManualUserMapping');
$this->logger->debug('IdP Parameter: ' . $this->idpParameter);
Expand Down Expand Up @@ -83,7 +85,7 @@ public function getLocation(array $data): string {
// dictionary contains regular expressions
if (!empty($key) && is_array($dictionary) && $this->useRegularExpressions) {
foreach ($dictionary as $regex => $nextcloudNode) {
$this->logger->debug('Testing regex: "' . $regex . '"');
$this->logger->debug('Testing regex="' . $regex . '", key="' . $key . '"');
if (preg_match($regex, $key) === 1) {
$this->logger->debug('Regex matched');
$location = $nextcloudNode;
Expand Down Expand Up @@ -134,6 +136,10 @@ private function getKey($data) {
$this->logger->debug('Could not find idpParamter: ' . $this->idpParameter);
}

if (!$this->normalizedKey) {
return $key;
}

return $this->normalizeKey($key);
}

Expand Down