Repository navigation
feat: allow exact UID lookup through Nextcloud global search - #219
vitormattos wants to merge 2 commits into
Conversation
Expose populated administrative profile fields through Nextcloud search using uid:<user>. Return paginated field results and deny private lookups to non-admins. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
YvesCesar
left a comment
There was a problem hiding this comment.
Thanks @vitormattos!
I made a few revisions. Could you take a look?
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
YvesCesar
left a comment
There was a problem hiding this comment.
Thanks @vitormattos! The previous points are resolved. I left one more comment, could you take a look?
| } | ||
|
|
||
| return trim((string)$scalar); | ||
| return is_bool($scalar) ? ($scalar ? 'true' : 'false') : trim((string)$scalar); |
There was a problem hiding this comment.
I missed this in my first comment: rendering booleans as words makes the regular search match them by substring. Since the minimum term length is 2, terms like al, se, ru or ue now match every visible boolean field. Searching for al (looking for "Alice") returns every user with a boolean set to false, with subline Enabled: false. Before this PR booleans never matched in the regular search, because false was '' and true was '1'.
Could boolean fields match only the whole word in search() (line 81)? Something like:
$scalarValue = $this->extractScalarValue($value);
if ($scalarValue === null) {
continue;
}
$normalizedValue = mb_strtolower($scalarValue);
$matches = $definition->getType() === FieldType::BOOLEAN->value
? $normalizedValue === $normalizedTerm
: str_contains($normalizedValue, $normalizedTerm);
if (!$matches) {
continue;
}testRegularSearchMatchesBooleanWords (line 249) would then search for false instead of fal, and could also assert that al returns no boolean match.
Objective
Allow the connected Nextcloud MCP to inspect Profile Fields through its existing unified search tool. No MCP Connector changes are required.
Changes
profile_fields.directoryrecognizesuid:<nextcloud_uid>for a Nextcloud instance administrator.falseasfalse, not an empty value.Validation
Security
IGroupManager::isAdminfor exact-UID inspection.This PR is independent from changes in any upstream MCP Connector repository.