From 3cdcc1b59b24b3510ad9ab44ff0201128ea9a202 Mon Sep 17 00:00:00 2001 From: ZzIsGod1019 <1498852723@qq.com> Date: Tue, 9 Apr 2024 10:51:30 +0800 Subject: [PATCH] open-api: fix bug && update test (#702) * open-api: fix bug * update --- backend/supports/iam/src/basic/serv/iam_open_serv.rs | 5 +++++ .../iam/src/console_interface/api/iam_ci_open_api.rs | 2 +- backend/supports/iam/tests/test_ci_open.rs | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/supports/iam/src/basic/serv/iam_open_serv.rs b/backend/supports/iam/src/basic/serv/iam_open_serv.rs index f4610d19e..09aec2868 100644 --- a/backend/supports/iam/src/basic/serv/iam_open_serv.rs +++ b/backend/supports/iam/src/basic/serv/iam_open_serv.rs @@ -445,6 +445,10 @@ impl IamOpenServ { // let spec_id = IamRelServ::find_from_id_rels(&IamRelKind::IamCertSpec, false, &cert_id, None, None, funs, ctx).await?.pop().unwrap_or_default(); let spec_id = RbumRelServ::find_detail_rbums( &RbumRelFilterReq { + basic: RbumBasicFilterReq { + with_sub_own_paths: true, + ..Default::default() + }, from_rbum_id: Some(cert_id.to_string()), from_rbum_kind: Some(RbumRelFromKind::Cert), tag: Some(IamRelKind::IamCertSpec.to_string()), @@ -463,6 +467,7 @@ impl IamOpenServ { let spec_code = IamResServ::find_one_detail_item( &IamResFilterReq { basic: RbumBasicFilterReq { + with_sub_own_paths: true, ids: Some(vec![spec_id]), ..Default::default() }, diff --git a/backend/supports/iam/src/console_interface/api/iam_ci_open_api.rs b/backend/supports/iam/src/console_interface/api/iam_ci_open_api.rs index 829c6491f..780700d45 100644 --- a/backend/supports/iam/src/console_interface/api/iam_ci_open_api.rs +++ b/backend/supports/iam/src/console_interface/api/iam_ci_open_api.rs @@ -68,7 +68,7 @@ impl IamCiOpenApi { /// Get account rule info / 获取账号规则信息 #[oai(path = "/", method = "get")] - async fn get_rule_info(&self, cert_id: Query>, ak: Query>, request: &Request) -> TardisApiResult { + async fn get_rule_info(&self, cert_id: Query>, ak: Query>, _request: &Request) -> TardisApiResult { let mut funs = iam_constants::get_tardis_inst(); let global_ctx = TardisContext { own_paths: "".to_string(), diff --git a/backend/supports/iam/tests/test_ci_open.rs b/backend/supports/iam/tests/test_ci_open.rs index 8c9e65e15..09a4389cd 100644 --- a/backend/supports/iam/tests/test_ci_open.rs +++ b/backend/supports/iam/tests/test_ci_open.rs @@ -110,7 +110,11 @@ pub async fn test(context1: &TardisContext) -> TardisResult<()> { ) .await?; info!("【test_ci_open】 : Get account info"); - let info = IamOpenServ::get_rule_info(Some(cert_id.clone()), None, &funs, context1).await?; + let global_ctx = TardisContext { + own_paths: "".to_string(), + ..Default::default() + }; + let info = IamOpenServ::get_rule_info(Some(cert_id.clone()), None, &funs, &global_ctx).await?; assert_eq!(info.cert_id, cert_id.clone()); assert_eq!(info.spec_code, spec1_code.clone()); assert_eq!(info.api_call_frequency, Some(500));