Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix adding and removing permissions #13027

Merged
merged 5 commits into from
Aug 22, 2024

Conversation

danxuliu
Copy link
Member

Even if call permissions will be removed in Talk 21 right now they are available through the API, so they should to be fixed. Moreover, technically adding and removing permissions could be done too with room permissions, even if right now the API only allows that with call permissions (which on the other hand could be a hint to also remove adding/removing permissions and just allow setting them).

For the details please refer to the integration tests and the description in each individual commit.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When adding permissions to all attendees the permissions are added to
the call/room and to the attendees. Attendees with default permissions
will get the effective permissions from the call/room permissions, so
the permissions should be added only to those attendees that already
have custom permissions.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When adding or removing attendee permissions the permissions are
decomposed in each separate permission and added or removed
individually. However, the same query object was reused, so once it was
executed for the first permission found then it no longer worked as
expected for the following permissions.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When adding or removing call permissions the default room permissions
should be taken as a base if no call permission is set. Otherwise adding
will cause the permissions to be set instead of added, while removing
them will have no effect.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu
Copy link
Member Author

/backport to stable30

@danxuliu
Copy link
Member Author

/backport to stable29

@danxuliu
Copy link
Member Author

/backport to stable28

@nickvergessen
Copy link
Member

which on the other hand could be a hint to also remove adding/removing permissions and just allow setting them

Yeah, that was my next plan. Also since there is no client/UI allowing that atm (or is the lobby bypass using that?)

@danxuliu
Copy link
Member Author

danxuliu commented Aug 19, 2024

which on the other hand could be a hint to also remove adding/removing permissions and just allow setting them

Yeah, that was my next plan. Also since there is no client/UI allowing that atm (or is the lobby bypass using that?)

It does (although for specific participants, not for the whole room):

async setLobbyPermission(value) {
try {
await this.$store.dispatch('setPermissions', {
token: this.token,
attendeeId: this.attendeeId,
method: value ? 'add' : 'remove',
permissions: PARTICIPANT.PERMISSIONS.LOBBY_IGNORE,
})

$result = $this->participantService->updatePermissions($this->room, $targetParticipant, $method, $permissions);

@danxuliu danxuliu closed this Aug 19, 2024
@danxuliu danxuliu reopened this Aug 19, 2024
@danxuliu
Copy link
Member Author

Double click 🤦

@@ -227,6 +221,8 @@ public function modifyPermissions(int $roomId, string $mode, int $newState): voi
Attendee::PERMISSIONS_LOBBY_IGNORE,
] as $permission) {
if ($permission & $newState) {
$query = $this->getModifyPermissionsBaseQuery($roomId);
Copy link
Member

Choose a reason for hiding this comment

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

this could be outside the loop? We don't need to create the query builder 7 times?

Copy link
Member Author

Choose a reason for hiding this comment

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

The query builder would be created as many times as individual permissions are added/removed, so it would be created seven times only if the seven permissions were added/removed at once.

A single query object needs to be created for each individual permission because adding or removing a single permission executes the statement. Is there any way to reset the query builder to reuse the same base update query and change the set and andWhere parts?

@nickvergessen nickvergessen merged commit 61960ae into main Aug 22, 2024
132 checks passed
@nickvergessen nickvergessen deleted the fix-adding-and-removing-permissions branch August 22, 2024 07:53
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.

2 participants