Merge pull request #59734 from nextcloud/backport/59719/stable33

This commit is contained in:
Benjamin Gaussorgues 2026-04-21 08:04:18 +02:00 committed by GitHub
commit a0ad2f4794
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,6 +11,7 @@ namespace OC\Core\Db;
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use OCP\Profile\IProfileManager;
use OCP\Profile\ParameterDoesNotExistException;
use function json_decode;
use function json_encode;
@ -68,7 +69,7 @@ class ProfileConfig extends Entity implements JsonSerializable {
foreach ($visibilityMap as $paramId => $visibility) {
$config[$paramId] = array_merge(
$config[$paramId] ?: [],
['visibility' => $visibility],
['visibility' => $this->normalizeVisibility($visibility)],
);
}
@ -103,4 +104,12 @@ class ProfileConfig extends Entity implements JsonSerializable {
'config' => $this->getConfigArray(),
];
}
private function normalizeVisibility(string $visibility): string {
return match(strtolower($visibility)) {
IProfileManager::VISIBILITY_SHOW => IProfileManager::VISIBILITY_SHOW,
IProfileManager::VISIBILITY_SHOW_USERS_ONLY => IProfileManager::VISIBILITY_SHOW_USERS_ONLY,
default => IProfileManager::VISIBILITY_HIDE,
};
}
}