feat(nacos): add access control support
This commit is contained in:
67 files changed
+9062
-135
No files matched your search
@@ -1259,7 +1259,7 @@ async fn test_connection_with_info_inner(
|
||||
DatabaseType::Nacos => {
|
||||
let admin_config = state.nacos_admin_config_for_connection(connection_id, &config).await?;
|
||||
let adapter = state.nacos_registry.build_transient_config(admin_config).await?;
|
||||
adapter.test_connection().await?;
|
||||
adapter.test_connection_with_scope_validation().await?;
|
||||
Ok("Connection successful".to_string())
|
||||
}
|
||||
DatabaseType::Consul => {
|
||||
@@ -1386,6 +1386,7 @@ pub async fn connect_db(
|
||||
let mut connected_db_config = db_config.clone();
|
||||
|
||||
state.remove_connection_pools_detached(&id).await;
|
||||
drop_nacos_adapters_for_connection_ids(state.inner(), std::slice::from_ref(&id)).await;
|
||||
state.reset_connection_transport_for_config(&id, &db_config).await;
|
||||
|
||||
let (host, port) = state.connection_host_port(&id, &db_config).await?;
|
||||
|
||||
@@ -22,6 +22,14 @@ pub async fn nacos_list_namespaces(
|
||||
dbx_core::nacos::service::nacos_list_namespaces_core(&state, &connection_id).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_sidebar_snapshot(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
) -> Result<dbx_core::nacos::NacosNamespaceSidebarSnapshot, String> {
|
||||
dbx_core::nacos::service::nacos_sidebar_snapshot_core(&state, &connection_id).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_create_namespace(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
@@ -120,6 +128,113 @@ pub async fn nacos_login_rnacos_console(
|
||||
dbx_core::nacos::service::nacos_login_rnacos_console_core(&state, &connection_id, captcha).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_list_users(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
query: dbx_core::nacos::NacosUserQuery,
|
||||
) -> Result<dbx_core::nacos::NacosUserList, String> {
|
||||
dbx_core::nacos::service::nacos_list_users_core(&state, &connection_id, query).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_create_user(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
req: dbx_core::nacos::NacosUserCreate,
|
||||
) -> Result<(), String> {
|
||||
dbx_core::nacos::service::nacos_create_user_core(&state, &connection_id, req).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_update_user(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
req: dbx_core::nacos::NacosUserUpdate,
|
||||
) -> Result<(), String> {
|
||||
dbx_core::nacos::service::nacos_update_user_core(&state, &connection_id, req).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_delete_user(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
username: String,
|
||||
) -> Result<(), String> {
|
||||
dbx_core::nacos::service::nacos_delete_user_core(&state, &connection_id, username).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_list_role_bindings(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
query: dbx_core::nacos::NacosRoleQuery,
|
||||
) -> Result<dbx_core::nacos::NacosRoleList, String> {
|
||||
dbx_core::nacos::service::nacos_list_role_bindings_core(&state, &connection_id, query).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_assign_role(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
binding: dbx_core::nacos::NacosRoleBinding,
|
||||
) -> Result<(), String> {
|
||||
dbx_core::nacos::service::nacos_assign_role_core(&state, &connection_id, binding).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_remove_role(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
binding: dbx_core::nacos::NacosRoleBinding,
|
||||
) -> Result<(), String> {
|
||||
dbx_core::nacos::service::nacos_remove_role_core(&state, &connection_id, binding).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_access_snapshot(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
) -> Result<dbx_core::nacos::NacosAccessControlSnapshot, String> {
|
||||
dbx_core::nacos::service::nacos_access_snapshot_core(&state, &connection_id).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_start_access_operation(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
req: dbx_core::nacos::NacosAccessOperationRequest,
|
||||
) -> Result<dbx_core::nacos::NacosAccessOperationResult, String> {
|
||||
dbx_core::nacos::service::nacos_start_access_operation_core(&state, &connection_id, req).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_get_access_operation(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
operation_id: String,
|
||||
) -> Result<dbx_core::nacos::NacosAccessOperationResult, String> {
|
||||
dbx_core::nacos::service::nacos_get_access_operation_core(&state, &connection_id, &operation_id).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_retry_access_operation(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
retry: dbx_core::nacos::NacosAccessOperationRetry,
|
||||
) -> Result<dbx_core::nacos::NacosAccessOperationResult, String> {
|
||||
dbx_core::nacos::service::nacos_retry_access_operation_core(&state, &connection_id, retry).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_undo_access_operation(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
operation_id: String,
|
||||
) -> Result<dbx_core::nacos::NacosAccessOperationResult, String> {
|
||||
dbx_core::nacos::service::nacos_undo_access_operation_core(&state, &connection_id, &operation_id).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn nacos_list_services(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
|
||||
Reference in new issue
Block a user