Schema adjustments

This commit is contained in:
Maurus Decimus
2026-04-07 19:48:30 +02:00
parent fde37b670f
commit 83c79d1fd7
10 changed files with 16 additions and 35 deletions

View File

@@ -12,8 +12,7 @@ use serde::Serialize;
#[derive(Debug, Clone, Serialize)]
pub struct Permissions {
pub permissions: Vec<Permission>,
#[serde(rename = "isEnterprise")]
pub is_enterprise: bool,
pub edition: &'static str,
}
pub trait PermissionsApiHandler: Sync + Send {
@@ -29,18 +28,22 @@ impl PermissionsApiHandler for Server {
access_token: &AccessToken,
) -> trc::Result<HttpResponse> {
#[cfg(not(feature = "enterprise"))]
let is_enterprise = false;
let edition = "oss";
// SPDX-SnippetBegin
// SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
// SPDX-License-Identifier: LicenseRef-SEL
#[cfg(feature = "enterprise")]
let is_enterprise = self.core.is_enterprise_edition();
let edition = if self.core.is_enterprise_edition() {
"enterprise"
} else {
"community"
};
// SPDX-SnippetEnd
Ok(JsonResponse::new(Permissions {
permissions: access_token.permissions(),
is_enterprise,
edition,
})
.into_http_response())
}