feat(ocp): expose whether talk is enabled for user

Signed-off-by: Hamza <hamzamahjoubi221@gmail.com>
This commit is contained in:
Hamza 2026-04-26 16:58:21 +02:00
parent 836546414e
commit 950a3f8d37
3 changed files with 64 additions and 0 deletions

View file

@ -91,4 +91,20 @@ class Broker implements IBroker {
$this->backend->deleteConversation($id);
}
public function isDisabledForUser(): bool {
if (!$this->hasBackend()) {
return true;
}
return $this->backend->isDisabledForUser();
}
public function isNotAllowedToCreateConversations(): bool {
if (!$this->hasBackend()) {
return true;
}
return $this->backend->isNotAllowedToCreateConversations();
}
}

View file

@ -65,4 +65,28 @@ interface IBroker {
* @since 26.0.0
*/
public function deleteConversation(string $id): void;
/**
* Check if the logged in user is not allowed to create conversations,
* respecting the per-group restrictions configured in Talk admin settings
* (allowed_groups).
*
* Returns false when Talk is not available at all.
*
* @return bool
* @since 34.0.0
*/
public function isNotAllowedToCreateConversations(): bool;
/**
* Check if Talk is disabled for the logged in user, respecting the
* per-group restriction configured in Talk admin settings
* (start_conversations).
*
* Returns false when Talk is not available at all.
*
* @return bool
* @since 34.0.0
*/
public function isDisabledForUser(): bool;
}

View file

@ -42,4 +42,28 @@ interface ITalkBackend {
* @since 26.0.0
*/
public function deleteConversation(string $id): void;
/**
* Check if the logged in user is not allowed to create conversations,
* respecting the per-group restrictions configured in Talk admin settings
* (allowed_groups).
*
* Returns false when Talk is not available at all.
*
* @return bool
* @since 34.0.0
*/
public function isNotAllowedToCreateConversations(): bool;
/**
* Check if Talk is disabled for the logged in user, respecting the
* per-group restriction configured in Talk admin settings
* (start_conversations).
*
* Returns false when Talk is not available at all.
*
* @return bool
* @since 34.0.0
*/
public function isDisabledForUser(): bool;
}