Redesign sensitive info protection settings

This commit is contained in:
fawney19
2026-05-14 11:14:20 +08:00
parent 91955ad1e0
commit 509bd30252
71 changed files with 3254 additions and 884 deletions

View File

@@ -14,6 +14,18 @@ impl AppState {
.and_then(|record| record.force_capabilities))
}
pub(crate) async fn read_auth_api_key_feature_settings(
&self,
user_id: &str,
api_key_id: &str,
is_standalone: bool,
) -> Result<Option<serde_json::Value>, GatewayError> {
self.data
.read_auth_api_key_feature_settings(user_id, api_key_id, is_standalone)
.await
.map_err(|err| GatewayError::Internal(err.to_string()))
}
pub(crate) async fn list_auth_api_key_export_records_by_user_ids(
&self,
user_ids: &[String],
@@ -329,6 +341,41 @@ impl AppState {
Ok(api_key)
}
pub(crate) async fn set_user_api_key_feature_settings(
&self,
user_id: &str,
api_key_id: &str,
feature_settings: Option<serde_json::Value>,
) -> Result<Option<aether_data::repository::auth::StoredAuthApiKeyExportRecord>, GatewayError>
{
let api_key = self
.data
.set_user_api_key_feature_settings(user_id, api_key_id, feature_settings)
.await
.map_err(|err| GatewayError::Internal(err.to_string()))?;
if api_key.is_some() {
self.invalidate_auth_context_cache();
}
Ok(api_key)
}
pub(crate) async fn set_standalone_api_key_feature_settings(
&self,
api_key_id: &str,
feature_settings: Option<serde_json::Value>,
) -> Result<Option<aether_data::repository::auth::StoredAuthApiKeyExportRecord>, GatewayError>
{
let api_key = self
.data
.set_standalone_api_key_feature_settings(api_key_id, feature_settings)
.await
.map_err(|err| GatewayError::Internal(err.to_string()))?;
if api_key.is_some() {
self.invalidate_auth_context_cache();
}
Ok(api_key)
}
pub(crate) async fn delete_user_api_key(
&self,
user_id: &str,

View File

@@ -52,6 +52,32 @@ impl AppState {
.map_err(|err| GatewayError::Internal(err.to_string()))
}
pub(crate) async fn read_user_feature_settings(
&self,
user_id: &str,
) -> Result<Option<serde_json::Value>, GatewayError> {
self.data
.read_user_feature_settings(user_id)
.await
.map_err(|err| GatewayError::Internal(err.to_string()))
}
pub(crate) async fn update_user_feature_settings(
&self,
user_id: &str,
settings: Option<serde_json::Value>,
) -> Result<Option<serde_json::Value>, GatewayError> {
let updated = self
.data
.update_user_feature_settings(user_id, settings)
.await
.map_err(|err| GatewayError::Internal(err.to_string()))?;
if updated.is_some() {
self.invalidate_auth_context_cache();
}
Ok(updated)
}
pub(crate) async fn find_active_provider_name(
&self,
provider_id: &str,