Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lib/OCP/TalkBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@

namespace OCA\Talk\OCP;

use OCA\Talk\Config;
use OCA\Talk\Manager;
use OCA\Talk\Model\Attendee;
use OCA\Talk\Participant;
use OCA\Talk\Room;
use OCA\Talk\Service\ParticipantService;
use OCA\Talk\Service\RoomService;
use OCP\IURLGenerator;
use OCP\IUserSession;
use OCP\Talk\IConversation;
use OCP\Talk\IConversationOptions;
use OCP\Talk\ITalkBackend;
Expand All @@ -27,6 +29,8 @@ public function __construct(
protected ParticipantService $participantService,
protected RoomService $roomService,
protected IURLGenerator $url,
protected IUserSession $userSession,
protected Config $config,
) {
}

Expand Down Expand Up @@ -68,4 +72,21 @@ public function deleteConversation(string $id): void {
$room = $this->manager->getRoomByToken($id);
$this->roomService->deleteRoom($room);
}

public function isAllowedToCreateConversations(): bool {
$user = $this->userSession->getUser();
if ($user === null) {
return false;
}

return !$this->config->isNotAllowedToCreateConversations($user);
}

public function isEnabledForUser(): bool {
$user = $this->userSession->getUser();
if ($user === null) {
return false;
}
return !$this->config->isDisabledForUser($user);
}
}
8 changes: 7 additions & 1 deletion tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="6.15.1@28dc127af1b5aecd52314f6f645bafc10d0e11f9">
<files psalm-version="6.16.1@f1f5de594dc76faf8784e02d3dc4716c91c6f6ac">
<file src="lib/AppInfo/Application.php">
<UndefinedClass>
<code><![CDATA[BeforeTemplateRenderedEvent]]></code>
Expand Down Expand Up @@ -150,6 +150,12 @@
<code><![CDATA[$this->rooms]]></code>
</InvalidPropertyAssignmentValue>
</file>
<file src="lib/OCP/TalkBackend.php">
<MissingOverrideAttribute>
<code><![CDATA[public function isAllowedToCreateConversations(): bool {]]></code>
<code><![CDATA[public function isEnabledForUser(): bool {]]></code>
</MissingOverrideAttribute>
</file>
<file src="lib/PublicShare/TemplateLoader.php">
<UndefinedClass>
<code><![CDATA[BeforeTemplateRenderedEvent]]></code>
Expand Down
Loading