summaryrefslogtreecommitdiffstats
path: root/lib/Collaboration
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-04-30 10:52:52 +0200
committerJoas Schilling <coding@schilljs.com>2021-04-30 10:52:52 +0200
commit3aa8e604d117501fb20aba5669a22eb190069ef9 (patch)
tree237a91bb29fae786262d1aeb1b1e85206d1c42f2 /lib/Collaboration
parentecc1d2a8f326419d901b60a301c9c31fc5cc56e3 (diff)
Do not allow to manually interact with the bridge-bot user
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Collaboration')
-rw-r--r--lib/Collaboration/Collaborators/Listener.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Collaboration/Collaborators/Listener.php b/lib/Collaboration/Collaborators/Listener.php
index a7da8da38..dbf6fc3c6 100644
--- a/lib/Collaboration/Collaborators/Listener.php
+++ b/lib/Collaboration/Collaborators/Listener.php
@@ -27,6 +27,7 @@ use OCA\Talk\Config;
use OCA\Talk\Exceptions\ParticipantNotFoundException;
use OCA\Talk\Exceptions\RoomNotFoundException;
use OCA\Talk\Manager;
+use OCA\Talk\MatterbridgeManager;
use OCA\Talk\Model\Attendee;
use OCA\Talk\Participant;
use OCA\Talk\Room;
@@ -70,6 +71,7 @@ class Listener {
$event->setResults($listener->filterUsersAndGroupsWithoutTalk($event->getResults()));
+ $event->setResults($listener->filterBridgeBot($event->getResults()));
if ($event->getItemId() !== 'new') {
$event->setResults($listener->filterExistingParticipants($event->getItemId(), $event->getResults()));
}
@@ -108,6 +110,17 @@ class Listener {
return \in_array($result['value']['shareWith'], $this->allowedGroupIds, true);
}
+ protected function filterBridgeBot(array $results): array {
+ if (!empty($results['users'])) {
+ $results['users'] = array_filter($results['users'], [$this, 'filterBridgeBotUserResult']);
+ }
+ if (!empty($results['exact']['users'])) {
+ $results['exact']['users'] = array_filter($results['exact']['users'], [$this, 'filterBridgeBotUserResult']);
+ }
+
+ return $results;
+ }
+
protected function filterExistingParticipants(string $token, array $results): array {
try {
$this->room = $this->manager->getRoomByToken($token);
@@ -132,6 +145,10 @@ class Listener {
return $results;
}
+ protected function filterBridgeBotUserResult(array $result): bool {
+ return $result['value']['shareWith'] !== MatterbridgeManager::BRIDGE_BOT_USERID;
+ }
+
protected function filterParticipantUserResult(array $result): bool {
$userId = $result['value']['shareWith'];