Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/developer-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ The provided `docker-compose.yml` file from `nextcloud-docker-dev` supports spin

6. Enable federation in the admin settings of Nextcloud Talk or alternatively via occ:

./scripts/occ.sh nextcloud -- config:app:set spreed federation_enabled --value yes
./scripts/occ.sh nextcloud2 -- config:app:set spreed federation_enabled --value yes
./scripts/occ.sh nextcloud -- config:app:set spreed federation_enabled --value true --type boolean
./scripts/occ.sh nextcloud2 -- config:app:set spreed federation_enabled --value true --type boolean

### Rebuild / update Talk after code changes

Expand Down
146 changes: 73 additions & 73 deletions docs/settings.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\AppFramework\Services\IAppConfig;
use OCP\Calendar\Events\CalendarObjectCreatedEvent;
use OCP\Calendar\Events\CalendarObjectUpdatedEvent;
use OCP\Collaboration\AutoComplete\AutoCompleteFilterEvent;
Expand All @@ -152,7 +153,6 @@
use OCP\Group\Events\GroupDeletedEvent;
use OCP\Group\Events\UserAddedEvent;
use OCP\Group\Events\UserRemovedEvent;
use OCP\IConfig;
use OCP\INavigationManager;
use OCP\IURLGenerator;
use OCP\IUser;
Expand Down Expand Up @@ -433,10 +433,10 @@ public function registerNavigationLink(INavigationManager $navigationManager): v
}

public function registerCloudFederationProviderManager(
IConfig $config,
IAppConfig $appConfig,
ICloudFederationProviderManager $manager,
): void {
if ($config->getAppValue('spreed', 'federation_enabled', 'no') !== 'yes') {
if (!$appConfig->getAppValueBool(Config::FEDERATION_ENABLED)) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,9 @@ public function getCapabilities(): array {
if ($this->talkConfig->isFederationEnabled() && $this->talkConfig->isFederationEnabledForUserId($user)) {
$capabilities['config']['federation'] = [
'enabled' => true,
'incoming-enabled' => $this->appConfig->getAppValueBool('federation_incoming_enabled', true),
'outgoing-enabled' => $this->appConfig->getAppValueBool('federation_outgoing_enabled', true),
'only-trusted-servers' => $this->appConfig->getAppValueBool('federation_only_trusted_servers'),
'incoming-enabled' => $this->appConfig->getAppValueBool(Config::FEDERATION_INCOMING_ENABLED),
'outgoing-enabled' => $this->appConfig->getAppValueBool(Config::FEDERATION_OUTGOING_ENABLED),
'only-trusted-servers' => $this->appConfig->getAppValueBool(Config::FEDERATION_ONLY_TRUSTED_SERVERS),
];
}

Expand Down
9 changes: 7 additions & 2 deletions lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class Config {
public const string ALLOWED_GROUPS_TALK = 'allowed_groups';
public const string ALLOWED_GROUPS_SIP = 'sip_bridge_groups';
public const string ALLOWED_GROUPS_CONVERSATIONS = 'start_conversations';
public const string ALLOWED_GROUPS_FEDERATION = 'federation_allowed_groups';
public const string FEDERATION_ENABLED = 'federation_enabled';
public const string FEDERATION_INCOMING_ENABLED = 'federation_incoming_enabled';
public const string FEDERATION_OUTGOING_ENABLED = 'federation_outgoing_enabled';
public const string FEDERATION_ONLY_TRUSTED_SERVERS = 'federation_only_trusted_servers';
public const string BREAKOUT_ROOMS_ENABLED = 'breakout_rooms';
public const string CONVERSATION_SUBFOLDERS = 'conversation_subfolders';
public const string DEFAULT_ROOM_PERMISSIONS = 'default_permissions';
Expand Down Expand Up @@ -128,11 +133,11 @@ public function isSIPConfigured(): bool {
*/
public function isFederationEnabled(): bool {
// TODO: Set to default true once implementation is complete
return $this->config->getAppValue('spreed', 'federation_enabled', 'no') === 'yes';
return $this->appConfig->getAppValueBool(self::FEDERATION_ENABLED);
}

public function isFederationEnabledForUserId(IUser $user): bool {
$allowedGroups = $this->appConfig->getAppValueArray('federation_allowed_groups', lazy: true);
$allowedGroups = $this->appConfig->getAppValueArray(self::ALLOWED_GROUPS_FEDERATION, lazy: true);
if (empty($allowedGroups)) {
return true;
}
Expand Down
5 changes: 5 additions & 0 deletions lib/ConfigLexicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public function getAppConfigs(): array {
new Entry(Config::ALLOWED_GROUPS_TALK, ValueType::ARRAY, [], definition: 'List of group ids that are allowed to use Talk'),
new Entry(Config::ALLOWED_GROUPS_SIP, ValueType::ARRAY, [], definition: 'List of group ids that are allowed to enable SIP dial-in in a conversation'),
new Entry(Config::ALLOWED_GROUPS_CONVERSATIONS, ValueType::ARRAY, [], definition: 'List of group ids that are allowed to create conversation'),
new Entry(Config::ALLOWED_GROUPS_FEDERATION, ValueType::ARRAY, [], definition: 'List of local group ids that are allowed to use federated features'),
new Entry(Config::FEDERATION_ENABLED, ValueType::BOOL, false, definition: 'Whether or not federation with this instance is allowed'),
new Entry(Config::FEDERATION_INCOMING_ENABLED, ValueType::BOOL, true, definition: 'Whether users of this instance can be invited to federated conversations'),
new Entry(Config::FEDERATION_OUTGOING_ENABLED, ValueType::BOOL, true, definition: 'Whether users of this instance can invite federated users into conversations'),
new Entry(Config::FEDERATION_ONLY_TRUSTED_SERVERS, ValueType::BOOL, false, definition: 'Whether federation should be limited to the list of "Trusted servers"'),
new Entry(Config::BREAKOUT_ROOMS_ENABLED, ValueType::BOOL, true, definition: 'Whether or not breakout rooms are allowed (Will only prevent creating new breakout rooms. Existing conversations are not modified.'),
new Entry(Config::CONVERSATION_SUBFOLDERS, ValueType::BOOL, true, definition: ''),
new Entry(Config::DEFAULT_ROOM_PERMISSIONS, ValueType::INT, 246, definition: 'Default permissions for non-moderators (see [constants list](constants.md#attendee-permissions) for bit flags)'),
Expand Down
10 changes: 5 additions & 5 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ protected function getTalkHashHeader(): array {
implode(',', $this->appConfig->getAppValueArray(Config::ALLOWED_GROUPS_CONVERSATIONS)),
$this->appConfig->getAppValueInt(Config::DEFAULT_ROOM_PERMISSIONS),
$this->appConfig->getAppValueBool(Config::BREAKOUT_ROOMS_ENABLED),
$this->config->getAppValue('spreed', 'federation_enabled'),
$this->appConfig->getAppValueBool(Config::FEDERATION_ENABLED),
$this->config->getAppValue('spreed', 'enable_matterbridge'),
implode(',', $this->appConfig->getAppValueArray(Config::ALLOWED_GROUPS_SIP)),
$this->config->getAppValue('spreed', 'sip_bridge_dialin_info'),
Expand All @@ -201,10 +201,10 @@ protected function getTalkHashHeader(): array {
$this->config->getAppValue('spreed', 'call_recording_summary'),
$this->config->getAppValue('theming', 'cachebuster', '1'),
$this->config->getUserValue($this->userId, 'theming', 'userCacheBuster', '0'),
$this->config->getAppValue('spreed', 'federation_incoming_enabled'),
$this->config->getAppValue('spreed', 'federation_outgoing_enabled'),
$this->config->getAppValue('spreed', 'federation_only_trusted_servers'),
$this->config->getAppValue('spreed', 'federation_allowed_groups', '[]'),
$this->appConfig->getAppValueBool(Config::FEDERATION_INCOMING_ENABLED),
$this->appConfig->getAppValueBool(Config::FEDERATION_OUTGOING_ENABLED),
$this->appConfig->getAppValueBool(Config::FEDERATION_ONLY_TRUSTED_SERVERS),
implode(',', $this->appConfig->getAppValueArray(Config::ALLOWED_GROUPS_FEDERATION)),
$this->appConfig->getAppValueInt('feature_hints_hidden'),
];

Expand Down
8 changes: 4 additions & 4 deletions lib/Settings/Admin/AdminSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ protected function initAllowedGroups(): void {

protected function initFederation(): void {
$this->initialState->provideInitialState('federation_enabled', $this->talkConfig->isFederationEnabled());
$this->initialState->provideInitialState('federation_incoming_enabled', $this->appConfig->getAppValueBool('federation_incoming_enabled', true));
$this->initialState->provideInitialState('federation_outgoing_enabled', $this->appConfig->getAppValueBool('federation_outgoing_enabled', true));
$this->initialState->provideInitialState('federation_only_trusted_servers', $this->appConfig->getAppValueBool('federation_only_trusted_servers'));
$this->initialState->provideInitialState('federation_allowed_groups', $this->appConfig->getAppValueArray('federation_allowed_groups'));
$this->initialState->provideInitialState('federation_incoming_enabled', $this->appConfig->getAppValueBool(Config::FEDERATION_INCOMING_ENABLED));
$this->initialState->provideInitialState('federation_outgoing_enabled', $this->appConfig->getAppValueBool(Config::FEDERATION_OUTGOING_ENABLED));
$this->initialState->provideInitialState('federation_only_trusted_servers', $this->appConfig->getAppValueBool(Config::FEDERATION_ONLY_TRUSTED_SERVERS));
$this->initialState->provideInitialState('federation_allowed_groups', $this->appConfig->getAppValueArray(Config::ALLOWED_GROUPS_FEDERATION));
}

protected function initMatterbridge(): void {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/federation/call.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Feature: federation/call
Given using server "REMOTE"
And user "participant2" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |
And using server "LOCAL"
And user "participant1" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |

Scenario: join call
Given user "participant1" creates room "room" (v4)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/federation/chat.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Feature: federation/chat
And user "participant2" exists
And user "participant3" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |
And using server "LOCAL"
Given user "participant1" exists
Given user "participant2" exists
Given user "participant3" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |

Scenario: Get mention suggestions (translating local users to federated users)
Given user "participant1" creates room "room" (v4)
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/features/federation/invite.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ Feature: federation/invite
Given using server "REMOTE"
Given user "participant2" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |
Given using server "LOCAL"
Given user "participant1" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |

Scenario: Federation is disabled
Given the following "spreed" app config is set
| federation_enabled | no |
| federation_enabled | false |
Given user "participant1" creates room "room" (v4)
| roomType | 3 |
| roomName | room |
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/federation/join-leave.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Feature: federation/join-leave
Given using server "REMOTE"
And user "participant2" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |
And using server "LOCAL"
And user "participant1" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |

Scenario: join a group room
Given user "participant1" creates room "room" (v4)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/federation/lobby.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Feature: federation/lobby
Given using server "REMOTE"
And user "participant2" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |
And using server "LOCAL"
And user "participant1" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |

Scenario: set lobby state
Given user "participant1" creates room "room" (v4)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/federation/ocm.feature
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Feature: federation/ocm
Scenario: Check that the OCM resource is not registered when federation is disabled
Given the following "spreed" app config is set
| federation_enabled | no |
| federation_enabled | false |
Then OCM provider does not have the following resource types
| name | shareTypes | protocols |
| talk-room | ["user"] | {"talk-v1":"/ocs/v2.php/apps/spreed/api/"} |

Scenario: Check that the OCM resource is registered when federation is enabled
Given the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |
Given OCM provider has the following resource types
| name | shareTypes | protocols |
| talk-room | ["user"] | {"talk-v1":"/ocs/v2.php/apps/spreed/api/"} |
4 changes: 2 additions & 2 deletions tests/integration/features/federation/permissions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Feature: federation/permissions
Given using server "REMOTE"
And user "participant2" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |
And using server "LOCAL"
And user "participant1" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |

@skip33
Scenario: set participant permissions
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/features/federation/poll.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ Feature: federation/poll
Given using server "REMOTE"
And user "participant2" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |
And using server "LOCAL"
Given user "participant1" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |

Scenario: Create a public poll without max votes limit
Given the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |
Given user "participant1" creates room "room" (v4)
| roomType | 2 |
| roomName | room |
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/federation/reminder.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Feature: federation/reminder
Given using server "REMOTE"
And user "participant2" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |
And using server "LOCAL"
Given user "participant1" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |

Scenario: Get mention suggestions (translating local users to federated users)
Given user "participant1" creates room "room" (v4)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/features/federation/user-statuses.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Feature: federation/user-statuses
And user "participant2" exists
And user "participant3" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |
And using server "LOCAL"
And user "participant1" exists
And the following "spreed" app config is set
| federation_enabled | yes |
| federation_enabled | true |

Scenario: User statuses are added to the participant request in federated conversations
Given user "participant1" creates room "room" (v4)
Expand Down