feat: Manage Trusted Servers via OCC command - #63440
Open
T0mWz wants to merge 1 commit into
Open
Conversation
T0mWz
requested review from
Altahrim,
come-nc and
icewind1991
and removed request for
a team
August 20, 2026 13:58
CarlSchwan
reviewed
Aug 20, 2026
| use Symfony\Component\Console\Input\InputOption; | ||
| use Symfony\Component\Console\Output\OutputInterface; | ||
|
|
||
| class ManageTrustedServers extends Command { |
Member
There was a problem hiding this comment.
It would be great if this was using the new AsCommand attribute, see for example the files app how this is done
CarlSchwan
reviewed
Aug 20, 2026
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'); |
Member
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Notes
--listignores the servers argument;--add/--removerequire at least one URL — enforced viaINVALID(exit 2) return codes.--removetakes a URL rather than an id (matching your ask), so findServerId() re-applies the samehttps://prefix + trailing-slash trim thatTrustedServers::addServer()used when the row was stored, then matches againstgetServers()to find the idremoveServer(int $id)needs.STATUS_OKetc.) are mapped to readable labels in the--listtable.