diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-09-15 15:57:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-15 15:57:51 +0300 |
commit | c4e4b8415a6072c62ed31e22b113c3222a8d1248 (patch) | |
tree | 1b9a3e4aaf8fcae69e3b59c1ea483ad3bf721de3 | |
parent | 99153c02882aa62b68ad8ecfb94e711f3e3b850b (diff) | |
parent | add1d45da840c9a0dfecadd2d6048bb393d69888 (diff) |
Merge pull request #7917 from nextcloud/bugfix/7476/flow-and-chat-permissionsv15.0.0-beta.4
Fix flow and chat permissions
-rw-r--r-- | lib/Flow/Operation.php | 11 | ||||
-rw-r--r-- | src/views/FlowPostToConversation.vue | 3 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Flow/Operation.php b/lib/Flow/Operation.php index cf95d3ada..0555e78e8 100644 --- a/lib/Flow/Operation.php +++ b/lib/Flow/Operation.php @@ -29,6 +29,7 @@ use OCA\Talk\Chat\ChatManager; use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager as TalkManager; +use OCA\Talk\Model\Attendee; use OCA\Talk\Participant; use OCA\Talk\Room; use OCP\EventDispatcher\Event; @@ -116,7 +117,17 @@ class Operation implements IOperation { } $room = $this->getRoom($token, $uid); + if ($room->getReadOnly() !== Room::READ_WRITE) { + // Ignore conversation because it is locked + continue; + } + $participant = $this->getParticipant($uid, $room); + if (!($participant->getPermissions() & Attendee::PERMISSIONS_CHAT)) { + // Ignore conversation because the user has no permissions + continue; + } + $this->chatManager->sendMessage( $room, $participant, diff --git a/src/views/FlowPostToConversation.vue b/src/views/FlowPostToConversation.vue index 179e88ff0..754a4157d 100644 --- a/src/views/FlowPostToConversation.vue +++ b/src/views/FlowPostToConversation.vue @@ -18,7 +18,7 @@ import NcMultiselect from '@nextcloud/vue/dist/Components/NcMultiselect.js' import axios from '@nextcloud/axios' import { generateOcsUrl } from '@nextcloud/router' -import { FLOW, CONVERSATION } from '../constants.js' +import { FLOW, CONVERSATION, PARTICIPANT } from '../constants.js' export default { name: 'FlowPostToConversation', @@ -80,6 +80,7 @@ export default { axios.get(generateOcsUrl('/apps/spreed/api/v4/room')).then((response) => { this.roomOptions = response.data.ocs.data.filter(function(room) { return room.readOnly === CONVERSATION.STATE.READ_WRITE + && (room.permissions & PARTICIPANT.PERMISSIONS.CHAT) !== 0 }) }) }, |