diff --git a/backend/middlewares/flow/src/serv/clients/search_client.rs b/backend/middlewares/flow/src/serv/clients/search_client.rs index 420fc9f7..46542a7e 100644 --- a/backend/middlewares/flow/src/serv/clients/search_client.rs +++ b/backend/middlewares/flow/src/serv/clients/search_client.rs @@ -149,22 +149,14 @@ impl FlowSearchClient { }), kv_disable: None, }; - if let Some(_topic) = get_topic(&SPI_RPC_TOPIC) { - EventCenterClient { topic_code: SPI_RPC_TOPIC }.add_item_and_name(&add_req, Some(model_resp.name.clone()), funs, ctx).await?; - } else { - SpiSearchClient::add_item_and_name(&add_req, Some(model_resp.name.clone()), funs, ctx).await?; - } + SpiSearchClient::add_item_and_name(&add_req, Some(model_resp.name.clone()), funs, ctx).await?; } Ok(()) } // model 全局搜索删除埋点方法 pub async fn delete_model_search(model_id: &str, funs: &TardisFunsInst, ctx: &TardisContext) -> TardisResult<()> { - if let Some(_topic) = get_topic(&SPI_RPC_TOPIC) { - EventCenterClient { topic_code: SPI_RPC_TOPIC }.delete_item_and_name(SEARCH_TAG, model_id, funs, ctx).await?; - } else { - SpiSearchClient::delete_item_and_name(SEARCH_TAG, model_id, funs, ctx).await?; - } + SpiSearchClient::delete_item_and_name(SEARCH_TAG, model_id, funs, ctx).await?; Ok(()) } } diff --git a/backend/supports/iam/src/basic/serv/iam_cert_serv.rs b/backend/supports/iam/src/basic/serv/iam_cert_serv.rs index a02c5488..41259325 100644 --- a/backend/supports/iam/src/basic/serv/iam_cert_serv.rs +++ b/backend/supports/iam/src/basic/serv/iam_cert_serv.rs @@ -583,7 +583,7 @@ impl IamCertServ { } pub async fn modify_3th_kind_cert(modify_req: &mut IamThirdPartyCertExtModifyReq, funs: &TardisFunsInst, ctx: &TardisContext) -> TardisResult<()> { - let cert_3th = Self::get_3th_kind_cert_by_rel_rbum_id(&modify_req.rel_rbum_id, vec![modify_req.supplier.clone()], false, None, funs, ctx).await?; + let cert_3th = Self::get_3th_kind_cert_by_rel_rbum_id(Some(modify_req.rel_rbum_id.clone()), Some(vec![modify_req.supplier.clone()]), false, None, funs, ctx).await?; RbumCertServ::modify_rbum( &cert_3th.id, &mut RbumCertModifyReq { @@ -693,8 +693,8 @@ impl IamCertServ { /// 通过关联rbum_item id 查询三方凭证 pub async fn get_3th_kind_cert_by_rel_rbum_id( - rel_rbum_id: &str, - cert_supplier: Vec, + rel_rbum_id: Option, + cert_supplier: Option>, show_sk: bool, ext: Option, funs: &TardisFunsInst, @@ -703,8 +703,8 @@ impl IamCertServ { let ext_cert = RbumCertServ::find_one_detail_rbum( &RbumCertFilterReq { kind: Some(IamCertExtKind::ThirdParty.to_string()), - suppliers: Some(cert_supplier.clone()), - rel_rbum_id: Some(rel_rbum_id.to_string()), + suppliers: cert_supplier.clone(), + rel_rbum_id, ext, ..Default::default() }, diff --git a/backend/supports/iam/src/console_interface/api/iam_ci_cert_api.rs b/backend/supports/iam/src/console_interface/api/iam_ci_cert_api.rs index 88b61f0b..40f09844 100644 --- a/backend/supports/iam/src/console_interface/api/iam_ci_cert_api.rs +++ b/backend/supports/iam/src/console_interface/api/iam_ci_cert_api.rs @@ -218,8 +218,8 @@ impl IamCiCertApi { #[oai(path = "/third-kind", method = "get")] async fn get_third_cert( &self, - account_id: Query, - supplier: Query, + account_id: Query>, + supplier: Query>, ext: Query>, mut ctx: TardisContextExtractor, request: &Request, @@ -227,7 +227,7 @@ impl IamCiCertApi { let funs = iam_constants::get_tardis_inst(); check_without_owner_and_unsafe_fill_ctx(request, &funs, &mut ctx.0)?; try_set_real_ip_from_req_to_ctx(request, &ctx.0).await?; - let rbum_cert = IamCertServ::get_3th_kind_cert_by_rel_rbum_id(&account_id.0, vec![supplier.0], true, ext.0, &funs, &ctx.0).await?; + let rbum_cert = IamCertServ::get_3th_kind_cert_by_rel_rbum_id(account_id.0, supplier.0.map(|supplier| vec![supplier]), true, ext.0, &funs, &ctx.0).await?; ctx.0.execute_task().await?; TardisResp::ok(rbum_cert) } diff --git a/backend/supports/iam/src/console_passport/api/iam_cp_cert_api.rs b/backend/supports/iam/src/console_passport/api/iam_cp_cert_api.rs index 1651e02e..ff7eaf99 100644 --- a/backend/supports/iam/src/console_passport/api/iam_cp_cert_api.rs +++ b/backend/supports/iam/src/console_passport/api/iam_cp_cert_api.rs @@ -137,7 +137,7 @@ impl IamCpCertApi { async fn get_third_cert(&self, supplier: Query, ctx: TardisContextExtractor, request: &Request) -> TardisApiResult { try_set_real_ip_from_req_to_ctx(request, &ctx.0).await?; let funs = iam_constants::get_tardis_inst(); - let rbum_cert = IamCertServ::get_3th_kind_cert_by_rel_rbum_id(&ctx.0.owner, vec![supplier.0], true, None, &funs, &ctx.0).await?; + let rbum_cert = IamCertServ::get_3th_kind_cert_by_rel_rbum_id(Some(ctx.0.owner.clone()), Some(vec![supplier.0]), true, None, &funs, &ctx.0).await?; ctx.0.execute_task().await?; TardisResp::ok(rbum_cert) } diff --git a/backend/supports/iam/src/console_tenant/api/iam_ct_cert_api.rs b/backend/supports/iam/src/console_tenant/api/iam_ct_cert_api.rs index f9c69965..f5db491b 100644 --- a/backend/supports/iam/src/console_tenant/api/iam_ct_cert_api.rs +++ b/backend/supports/iam/src/console_tenant/api/iam_ct_cert_api.rs @@ -85,7 +85,7 @@ impl IamCtCertApi { let ctx = IamCertServ::try_use_tenant_ctx(ctx.0, tenant_id.0)?; try_set_real_ip_from_req_to_ctx(request, &ctx).await?; let funs = iam_constants::get_tardis_inst(); - let rbum_cert = IamCertServ::get_3th_kind_cert_by_rel_rbum_id(&account_id.0, vec![cert_supplier.0], true, None, &funs, &ctx).await?; + let rbum_cert = IamCertServ::get_3th_kind_cert_by_rel_rbum_id(Some(account_id.0), Some(vec![cert_supplier.0]), true, None, &funs, &ctx).await?; ctx.execute_task().await?; TardisResp::ok(rbum_cert) } diff --git a/backend/supports/iam/tests/test_cc_cert.rs b/backend/supports/iam/tests/test_cc_cert.rs index e2ae31a6..4d908c74 100644 --- a/backend/supports/iam/tests/test_cc_cert.rs +++ b/backend/supports/iam/tests/test_cc_cert.rs @@ -167,7 +167,7 @@ async fn test_single_level(context: &TardisContext, ak: &str, another_context: & .await?; info!("【test_cc_cert】 : test_single_level : Add Ext Cert - Gitlab"); - assert!(IamCertServ::get_3th_kind_cert_by_rel_rbum_id(&account_info.account_id, vec!["gitlab".to_string()], false, &funs, context).await.is_err()); + assert!(IamCertServ::get_3th_kind_cert_by_rel_rbum_id(Some(account_info.account_id.clone()), Some(vec!["gitlab".to_string()]), false, None, &funs, context).await.is_err()); IamCertServ::add_3th_kind_cert( &mut IamThirdPartyCertExtAddReq { ak: "GitlabUserId".to_string(), @@ -183,7 +183,7 @@ async fn test_single_level(context: &TardisContext, ak: &str, another_context: & ) .await?; assert_eq!( - IamCertServ::get_3th_kind_cert_by_rel_rbum_id(&account_info.account_id, vec!["gitlab".to_string()], false, &funs, context).await?.ak, + IamCertServ::get_3th_kind_cert_by_rel_rbum_id(Some(account_info.account_id), Some(vec!["gitlab".to_string()]), false, None, &funs, context).await?.ak, "GitlabUserId" );