Skip to content

feat(contacts): support federated users/groups search when adding team members#57782

Merged
cristianscheid merged 3 commits intomasterfrom
feat/2303/contacts-allow-federated-team-member-search
Feb 5, 2026
Merged

feat(contacts): support federated users/groups search when adding team members#57782
cristianscheid merged 3 commits intomasterfrom
feat/2303/contacts-allow-federated-team-member-search

Conversation

@cristianscheid
Copy link
Contributor

@cristianscheid cristianscheid commented Jan 24, 2026

Summary

Adds possibility to search for federated users (accounts from other instances) and federated groups when adding members to a team in the Contacts app.

Context

When searching for members to add to a team in the Contacts app, a GET request is made to ocs/v2.php/apps/files_sharing/api/v1/sharees which in turn calls files_sharing/lib/Controller/ShareesAPIController::search().

This is the same endpoint used by the Files app when searching to add an external share (used as a reference here, as pointed out in the issue).

Changes

  • Modified files_sharing/lib/Controller/ShareesAPIController::search() to handle contacts itemType, allowing TYPE_REMOTE and TYPE_REMOTE_GROUP searches
  • Injected FederatedShareProvider into the controller constructor to check federation settings
  • Called federation check methods directly via FederatedShareProvider
    • The wrapper methods isRemoteSharingAllowed() and isRemoteGroupSharingAllowed() require a share backend implementation
    • They call isShareTypeAllowed(), which ultimately invokes the same FederatedShareProvider methods used in this implementation (isOutgoingServer2serverShareEnabled() and isOutgoingServer2serverGroupShareEnabled())
    • Since contacts doesn't have a registered share backend (similar to calendar), this direct approach was taken to achieve same functionality

Note

When testing locally, the federated search functionality works correctly (remote users appear in search results). However, when attempting to actually add the remote member to a team, an error occurs indicating the remote instance is unreachable. I believe this is expected behavior when running locally, as a similar error occurs when trying to add an external share in the Files app using the same remote account, which is the reference implementation mentioned in the issue and was not modified in this PR.

Checklist

@cristianscheid
Copy link
Contributor Author

/backport to stable33

…m members

Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
…e from member search controller

Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
salmart-dev
salmart-dev previously approved these changes Feb 5, 2026
@salmart-dev salmart-dev dismissed their stale review February 5, 2026 10:24

Missing test changes

Copy link
Contributor

@salmart-dev salmart-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think tests need to be adapted with the new changes, the ShareesAPIController tests are failing because of the extra constructor parameter

Copy link
Contributor

@come-nc come-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no documentation whatsoever about what’s accepted as an $itemType and that’s triggering me.
But not the subject of that PR I suppose.

I’m not sure why TYPE_EMAIL is added to $shareTypes in this new if branch, but is it seems a copypaste from the else with only remote added I guess it makes sense.

@cristianscheid
Copy link
Contributor Author

cristianscheid commented Feb 5, 2026

I think tests need to be adapted with the new changes, the ShareesAPIController tests are failing because of the extra constructor parameter

@salmart-dev thanks for the input! I'll look into it.

I’m not sure why TYPE_EMAIL is added to $shareTypes in this new if branch, but is it seems a copypaste from the else with only remote added I guess it makes sense.

@come-nc thanks for the review! Yes, basically the ideia was to keep the original functionallity (inside else) and add remote support, avoiding breaking or removing existing behavior and only introducing a new addition.

…ratedShareProvider dependency

Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
@cristianscheid cristianscheid merged commit 9cfaf9b into master Feb 5, 2026
216 of 227 checks passed
@cristianscheid cristianscheid deleted the feat/2303/contacts-allow-federated-team-member-search branch February 5, 2026 17:57
@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2026

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants