From 06347485354f6b34f0c57aee4e9fb85d4b796105 Mon Sep 17 00:00:00 2001 From: ljl <17743125563@163.com> Date: Mon, 22 Jan 2024 14:37:25 +0800 Subject: [PATCH] iam:fix search. --- support/iam/src/basic/serv/iam_set_serv.rs | 20 +++++++++++++++++-- .../src/console_tenant/api/iam_ct_org_api.rs | 3 ++- support/iam/src/iam_config.rs | 4 ++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/support/iam/src/basic/serv/iam_set_serv.rs b/support/iam/src/basic/serv/iam_set_serv.rs index e4dd8fe99..64e9c8cf2 100644 --- a/support/iam/src/basic/serv/iam_set_serv.rs +++ b/support/iam/src/basic/serv/iam_set_serv.rs @@ -185,7 +185,15 @@ impl IamSetServ { if kind == IamSetKind::Apps.to_string() && result.is_ok() { SpiKvClient::add_or_modify_key_name( - &format!("{}:{}", funs.conf::().spi.kv_tenant_prefix.clone(), result.clone().unwrap()), + &format!("{}:{}", funs.conf::().spi.kv_apps_prefix.clone(), result.clone().unwrap()), + &add_req.name, + funs, + ctx, + ) + .await?; + } else if kind == IamSetKind::Org.to_string() && result.is_ok() { + SpiKvClient::add_or_modify_key_name( + &format!("{}:{}", funs.conf::().spi.kv_orgs_prefix.clone(), result.clone().unwrap()), &add_req.name, funs, ctx, @@ -253,7 +261,15 @@ impl IamSetServ { let mut kind = item.kind; if kind == IamSetKind::Apps.to_string() { SpiKvClient::add_or_modify_key_name( - &format!("{}:{}", funs.conf::().spi.kv_tenant_prefix.clone(), &set_cate_id), + &format!("{}:{}", funs.conf::().spi.kv_apps_prefix.clone(), &set_cate_id.clone()), + &set_cate_item.name.clone(), + funs, + ctx, + ) + .await?; + } else if kind == IamSetKind::Org.to_string() && result.is_ok() { + SpiKvClient::add_or_modify_key_name( + &format!("{}:{}", funs.conf::().spi.kv_orgs_prefix.clone(), &set_cate_id), &set_cate_item.name.clone(), funs, ctx, diff --git a/support/iam/src/console_tenant/api/iam_ct_org_api.rs b/support/iam/src/console_tenant/api/iam_ct_org_api.rs index 14cdd0862..05e15a323 100644 --- a/support/iam/src/console_tenant/api/iam_ct_org_api.rs +++ b/support/iam/src/console_tenant/api/iam_ct_org_api.rs @@ -1,5 +1,6 @@ -use bios_basic::rbum::dto::rbum_filer_dto::{RbumRelFilterReq, RbumSetTreeFilterReq}; +use bios_basic::rbum::dto::rbum_filer_dto::{RbumRelFilterReq, RbumSetCateFilterReq, RbumSetTreeFilterReq}; use bios_basic::rbum::dto::rbum_set_dto::RbumSetTreeResp; +use bios_basic::rbum::serv::rbum_set_serv::RbumSetCateServ; use tardis::basic::dto::TardisContext; use tardis::web::context_extractor::TardisContextExtractor; use tardis::web::poem_openapi; diff --git a/support/iam/src/iam_config.rs b/support/iam/src/iam_config.rs index 9b3860d20..cddb402e2 100644 --- a/support/iam/src/iam_config.rs +++ b/support/iam/src/iam_config.rs @@ -103,6 +103,8 @@ pub struct IamSpiConfig { pub kv_tenant_prefix: String, pub kv_account_prefix: String, pub kv_app_prefix: String, + pub kv_apps_prefix: String, + pub kv_orgs_prefix: String, pub owner: String, } @@ -117,6 +119,8 @@ impl Default for IamSpiConfig { kv_tenant_prefix: "iam_tenant".to_string(), kv_account_prefix: "iam_account".to_string(), kv_app_prefix: "iam_app".to_string(), + kv_apps_prefix: "iam_apps".to_string(), + kv_orgs_prefix: "iam_orgs".to_string(), owner: "".to_string(), } }