Skip to content

feat: Manage Trusted Servers via OCC command - #63440

Open
T0mWz wants to merge 1 commit into
nextcloud:masterfrom
T0mWz:63439
Open

T0mWz wants to merge 1 commit into
nextcloud:masterfrom
T0mWz:63439

Conversation

@T0mWz

@T0mWz T0mWz commented Aug 20, 2026

Copy link
Copy Markdown

Issue

As an administrator, I currently have to manually add each URL one by one as a trusted server via the Web Interface. From an administrative standpoint, the ability to add a single URL or a list of URLs via the shell would be highly desirable.

See submitted issue; #63439

Wish

Add an OCC option to list and manage federated trusted servers. This would eliminate the need for multiple clicks and copy-and-paste actions. But it also makes automated management easier.

Usage

occ federation:trusted-servers --list
occ federation:trusted-servers --add https://a.example.com https://b.example.com
occ federation:trusted-servers --remove https://a.example.com

Notes

  • --list ignores the servers argument; --add/--remove require at least one URL — enforced via INVALID (exit 2) return codes.
  • --remove takes a URL rather than an id (matching your ask), so findServerId() re-applies the same https:// prefix + trailing-slash trim that TrustedServers::addServer() used when the row was stored, then matches against getServers() to find the id removeServer(int $id) needs.
  • Status codes (STATUS_OK etc.) are mapped to readable labels in the --list table.

@T0mWz
T0mWz requested review from a team and sorbaugh as code owners August 20, 2026 13:58
@T0mWz
T0mWz requested review from Altahrim, come-nc and icewind1991 and removed request for a team August 20, 2026 13:58
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class ManageTrustedServers extends Command {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be great if this was using the new AsCommand attribute, see for example the files app how this is done

Comment on lines +44 to +46
->addOption('add', null, InputOption::VALUE_NONE, 'add the given servers to the trusted servers list')
->addOption('remove', null, InputOption::VALUE_NONE, 'remove the given servers from the trusted servers list')
->addOption('list', null, InputOption::VALUE_NONE, 'list all trusted servers');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would prefer 3 sub commands federation:trusted-servers:add, federation:trusted-servers:remove and federation:trusted-servers:list.

You can have multiple command in a single class, see https://docs.nextcloud.com/server/latest/developer_manual/app_development/commands.html#multiple-commands-in-one-class

@CarlSchwan CarlSchwan added stale Ticket or PR with no recent activity and removed stale Ticket or PR with no recent activity labels Aug 31, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

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.)

@solracsf solracsf added this to the Nextcloud 36 milestone Sep 12, 2026

This branch has not been deployed

No deployments
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.

5 participants