Skip to content

Commit ee0f6cb

Browse files
committed
fix: Propagate permission changes of conversations to federated servers
When a participant does not have custom permissions the permissions are got from the conversation, so they need to be propagated as well to the federated servers to correctly calculate the participant permissions. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
1 parent d974964 commit ee0f6cb

3 files changed

Lines changed: 65 additions & 2 deletions

File tree

lib/Federation/CloudFederationProviderTalk.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,8 @@ private function roomModified(int $remoteAttendeeId, array $notification): array
362362
$this->roomService->setAvatar($room, $notification['newValue']);
363363
} elseif ($notification['changedProperty'] === ARoomModifiedEvent::PROPERTY_CALL_RECORDING) {
364364
$this->roomService->setCallRecording($room, $notification['newValue']);
365+
} elseif ($notification['changedProperty'] === ARoomModifiedEvent::PROPERTY_DEFAULT_PERMISSIONS) {
366+
$this->roomService->setDefaultPermissions($room, $notification['newValue']);
365367
} elseif ($notification['changedProperty'] === ARoomModifiedEvent::PROPERTY_DESCRIPTION) {
366368
$this->roomService->setDescription($room, $notification['newValue']);
367369
} elseif ($notification['changedProperty'] === ARoomModifiedEvent::PROPERTY_IN_CALL) {

lib/Federation/Proxy/TalkV1/Notifier/RoomModifiedListener.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function handle(Event $event): void {
5050
ARoomModifiedEvent::PROPERTY_ACTIVE_SINCE,
5151
ARoomModifiedEvent::PROPERTY_AVATAR,
5252
ARoomModifiedEvent::PROPERTY_CALL_RECORDING,
53+
ARoomModifiedEvent::PROPERTY_DEFAULT_PERMISSIONS,
5354
ARoomModifiedEvent::PROPERTY_DESCRIPTION,
5455
ARoomModifiedEvent::PROPERTY_IN_CALL,
5556
ARoomModifiedEvent::PROPERTY_LOBBY,

tests/integration/features/federation/permissions.feature

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ Feature: federation/permissions
33
Background:
44
Given user "participant1" exists
55
And user "participant2" exists
6-
And user "participant3" exists
76
And the following "spreed" app config is set
87
| federation_enabled | yes |
98

109
Scenario: set participant permissions
11-
Given user "participant1" creates room "room" (v4)
10+
Given user "participant3" exists
11+
And user "participant1" creates room "room" (v4)
1212
| roomType | 2 |
1313
| roomName | room name |
1414
And user "participant1" adds federated_user "participant2" to room "room" with 200 (v4)
@@ -32,3 +32,63 @@ Feature: federation/permissions
3232
Then user "participant3" is participant of room "LOCAL::room" (v4)
3333
| permissions | attendeePermissions |
3434
| SJAVPM | D |
35+
36+
Scenario: set default permissions
37+
Given user "participant1" creates room "room" (v4)
38+
| roomType | 2 |
39+
| roomName | room name |
40+
And user "participant1" adds federated_user "participant2" to room "room" with 200 (v4)
41+
And user "participant2" has the following invitations (v1)
42+
| remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
43+
| LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
44+
And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1)
45+
| id | name | type | remoteServer | remoteToken |
46+
| LOCAL::room | room name | 2 | LOCAL | room |
47+
When user "participant1" sets default permissions for room "room" to "LM" with 200 (v4)
48+
Then user "participant2" is participant of room "LOCAL::room" (v4)
49+
| defaultPermissions | attendeePermissions | permissions |
50+
| CLM | D | CLM |
51+
52+
Scenario: set default permissions before federated user accepts invitation
53+
Given user "participant1" creates room "room" (v4)
54+
| roomType | 2 |
55+
| roomName | room name |
56+
And user "participant1" adds federated_user "participant2" to room "room" with 200 (v4)
57+
And user "participant2" has the following invitations (v1)
58+
| remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
59+
| LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
60+
When user "participant1" sets default permissions for room "room" to "LM" with 200 (v4)
61+
And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1)
62+
| id | name | type | remoteServer | remoteToken |
63+
| LOCAL::room | room name | 2 | LOCAL | room |
64+
Then user "participant2" is participant of room "LOCAL::room" (v4)
65+
| defaultPermissions | attendeePermissions | permissions |
66+
| CLM | D | CLM |
67+
68+
Scenario: set participant permissions after setting conversation permissions and then invite another federated user
69+
Given user "participant3" exists
70+
And user "participant1" creates room "room" (v4)
71+
| roomType | 2 |
72+
| roomName | room name |
73+
And user "participant1" adds federated_user "participant2" to room "room" with 200 (v4)
74+
And user "participant2" has the following invitations (v1)
75+
| remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
76+
| LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
77+
And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1)
78+
| id | name | type | remoteServer | remoteToken |
79+
| LOCAL::room | room name | 2 | LOCAL | room |
80+
And user "participant1" sets default permissions for room "room" to "AVP" with 200 (v4)
81+
And user "participant1" sets permissions for "participant2@{$LOCAL_REMOTE_URL}" in room "room" to "S" with 200 (v4)
82+
When user "participant1" adds federated_user "participant3" to room "room" with 200 (v4)
83+
And user "participant3" has the following invitations (v1)
84+
| remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
85+
| LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
86+
And user "participant3" accepts invite to room "room" of server "LOCAL" with 200 (v1)
87+
| id | name | type | remoteServer | remoteToken |
88+
| LOCAL::room | room name | 2 | LOCAL | room |
89+
Then user "participant2" is participant of room "LOCAL::room" (v4)
90+
| permissions |
91+
| CS |
92+
And user "participant3" is participant of room "LOCAL::room" (v4)
93+
| permissions |
94+
| CAVP |

0 commit comments

Comments
 (0)