Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ZzIsGod1019 committed Sep 3, 2024
1 parent 6830ee4 commit 148af9f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 22 deletions.
12 changes: 2 additions & 10 deletions backend/middlewares/flow/src/serv/clients/search_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
}
10 changes: 5 additions & 5 deletions backend/supports/iam/src/basic/serv/iam_cert_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<String>,
rel_rbum_id: Option<String>,
cert_supplier: Option<Vec<String>>,
show_sk: bool,
ext: Option<String>,
funs: &TardisFunsInst,
Expand All @@ -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()
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,16 +218,16 @@ impl IamCiCertApi {
#[oai(path = "/third-kind", method = "get")]
async fn get_third_cert(
&self,
account_id: Query<String>,
supplier: Query<String>,
account_id: Query<Option<String>>,
supplier: Query<Option<String>>,
ext: Query<Option<String>>,
mut ctx: TardisContextExtractor,
request: &Request,
) -> TardisApiResult<RbumCertSummaryWithSkResp> {
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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl IamCpCertApi {
async fn get_third_cert(&self, supplier: Query<String>, ctx: TardisContextExtractor, request: &Request) -> TardisApiResult<RbumCertSummaryWithSkResp> {
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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions backend/supports/iam/tests/test_cc_cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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"
);

Expand Down

0 comments on commit 148af9f

Please sign in to comment.