diff --git a/lib/Db/UserMapper.php b/lib/Db/UserMapper.php index 0fa8dfa8..0b91419c 100644 --- a/lib/Db/UserMapper.php +++ b/lib/Db/UserMapper.php @@ -59,6 +59,29 @@ public function getUser(string $uid): User { public function find(string $search, $limit = null, $offset = null): array { $qb = $this->db->getQueryBuilder(); + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + $stack = []; + + foreach ($backtrace as $index => $trace) { + $class = $trace['class'] ?? ''; + $type = $trace['type'] ?? ''; + $function = $trace['function'] ?? ''; + $file = $trace['file'] ?? 'unknown file'; + $line = $trace['line'] ?? 'unknown line'; + + $stack[] = sprintf( + "#%d %s%s%s() called at [%s:%s]", + $index, + $class, + $type, + $function, + $file, + $line + ); + } + + $this->logger->debug("Find user by string: " . $search . " -- Call Stack:\n" . implode("\n", $stack)); + $oidcSystemConfig = $this->config->getSystemValue('user_oidc', []); $matchEmails = !isset($oidcSystemConfig['user_search_match_emails']) || $oidcSystemConfig['user_search_match_emails'] === true; if ($matchEmails) { @@ -91,6 +114,29 @@ public function find(string $search, $limit = null, $offset = null): array { public function findDisplayNames(string $search, $limit = null, $offset = null): array { $qb = $this->db->getQueryBuilder(); + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); + $stack = []; + + foreach ($backtrace as $index => $trace) { + $class = $trace['class'] ?? ''; + $type = $trace['type'] ?? ''; + $function = $trace['function'] ?? ''; + $file = $trace['file'] ?? 'unknown file'; + $line = $trace['line'] ?? 'unknown line'; + + $stack[] = sprintf( + "#%d %s%s%s() called at [%s:%s]", + $index, + $class, + $type, + $function, + $file, + $line + ); + } + + $this->logger->debug("Find user display names by string: " . $search . " -- Call Stack:\n" . implode("\n", $stack)); + $oidcSystemConfig = $this->config->getSystemValue('user_oidc', []); $matchEmails = !isset($oidcSystemConfig['user_search_match_emails']) || $oidcSystemConfig['user_search_match_emails'] === true; if ($matchEmails) {