Skip to content

Commit ab58c69

Browse files
committed
feat(talk-backend): expose whether talk is enabled for user
Signed-off-by: Hamza <hamzamahjoubi221@gmail.com>
1 parent c79b9af commit ab58c69

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

lib/OCP/TalkBackend.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99

1010
namespace OCA\Talk\OCP;
1111

12+
use OCA\Talk\Config;
1213
use OCA\Talk\Manager;
1314
use OCA\Talk\Model\Attendee;
1415
use OCA\Talk\Participant;
1516
use OCA\Talk\Room;
1617
use OCA\Talk\Service\ParticipantService;
1718
use OCA\Talk\Service\RoomService;
1819
use OCP\IURLGenerator;
20+
use OCP\IUserSession;
1921
use OCP\Talk\IConversation;
2022
use OCP\Talk\IConversationOptions;
2123
use OCP\Talk\ITalkBackend;
@@ -27,6 +29,8 @@ public function __construct(
2729
protected ParticipantService $participantService,
2830
protected RoomService $roomService,
2931
protected IURLGenerator $url,
32+
protected IUserSession $userSession,
33+
protected Config $config,
3034
) {
3135
}
3236

@@ -68,4 +72,23 @@ public function deleteConversation(string $id): void {
6872
$room = $this->manager->getRoomByToken($id);
6973
$this->roomService->deleteRoom($room);
7074
}
75+
76+
#[\Override]
77+
public function isDisabledForUser(): bool {
78+
$user = $this->userSession->getUser();
79+
if ($user === null) {
80+
return true;
81+
}
82+
return $this->config->isDisabledForUser($user);
83+
}
84+
85+
#[\Override]
86+
public function isNotAllowedToCreateConversations(): bool {
87+
$user = $this->userSession->getUser();
88+
if ($user === null) {
89+
return true;
90+
}
91+
return $this->config->isNotAllowedToCreateConversations($user);
92+
93+
}
7194
}

0 commit comments

Comments
 (0)