25 files changed
+481
-12
No files matched your search
@@ -334,6 +334,36 @@ pub async fn mongo_create_index(
|
||||
Ok(serde_json::json!({ "name": name }))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn mongo_create_user(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
database: String,
|
||||
user_json: String,
|
||||
write_concern_json: Option<String>,
|
||||
mcp_request: Option<bool>,
|
||||
) -> Result<serde_json::Value, String> {
|
||||
if mcp_request == Some(true) {
|
||||
crate::commands::mcp_bridge::ensure_mcp_dangerous_write_allowed_by_id(
|
||||
state.inner(),
|
||||
&connection_id,
|
||||
&database,
|
||||
"Create user",
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
ensure_connection_writable(&state, &connection_id, "Create user").await?;
|
||||
let affected_rows = dbx_core::mongo_ops::mongo_create_user_core(
|
||||
&state,
|
||||
&connection_id,
|
||||
&database,
|
||||
&user_json,
|
||||
write_concern_json.as_deref(),
|
||||
)
|
||||
.await?;
|
||||
Ok(serde_json::json!({ "affected_rows": affected_rows }))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn mongo_drop_indexes(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
|
||||
Reference in new issue
Block a user