Skip to content
Merged
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
27 changes: 21 additions & 6 deletions lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,30 @@ public function getAllowedTalkGroupIds(): array {
return \is_array($groups) ? $groups : [];
}

/**
* @return Participant::PRIVACY_*
*/
public function getUserReadPrivacy(string $userId): int {
return (int)$this->config->getUserValue(
return match ((int)$this->config->getUserValue(
$userId,
'spreed', 'read_status_privacy',
(string)Participant::PRIVACY_PUBLIC);
(string)Participant::PRIVACY_PUBLIC)) {
Participant::PRIVACY_PUBLIC => Participant::PRIVACY_PUBLIC,
default => Participant::PRIVACY_PRIVATE,
};
}

/**
* @return Participant::PRIVACY_*
*/
public function getUserTypingPrivacy(string $userId): int {
return (int)$this->config->getUserValue(
return match ((int)$this->config->getUserValue(
$userId,
'spreed', 'typing_privacy',
(string)Participant::PRIVACY_PUBLIC);

(string)Participant::PRIVACY_PUBLIC)) {
Participant::PRIVACY_PUBLIC => Participant::PRIVACY_PUBLIC,
default => Participant::PRIVACY_PRIVATE,
};
}

/**
Expand Down Expand Up @@ -256,11 +267,15 @@ public function isNotAllowedToCreateConversations(IUser $user): bool {
return empty(array_intersect($allowedGroups, $userGroups));
}

/**
* @return int<0, 255>
* @psalm-return int-mask-of<Attendee::PERMISSIONS_*>
*/
public function getDefaultPermissions(): int {
// Admin configured default permissions
$configurableDefault = $this->config->getAppValue('spreed', 'default_permissions');
if ($configurableDefault !== '') {
return (int)$configurableDefault;
return min(Attendee::PERMISSIONS_MAX_CUSTOM, max(Attendee::PERMISSIONS_DEFAULT, (int)$configurableDefault));
}

// Falling back to an unrestricted set of permissions, only ignoring the lobby is off
Expand Down