Skip to content

Commit

Permalink
iam: fix bug (res unbind) (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZzIsGod1019 authored Jan 4, 2024
1 parent 09260e7 commit 7bf8401
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion spi/spi-search/src/search_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pub const DOMAIN_CODE: &str = "spi-search";

pub const EVENT_ADD_SEARCH: &str = "spi-search/add";
pub const EVENT_MODIFY_SEARCH: &str = "spi-search/modify";
pub const EVENT_DELETE_SEARCH: &str = "spi-search/delete";
pub const EVENT_DELETE_SEARCH: &str = "spi-search/delete";
3 changes: 2 additions & 1 deletion spi/spi-search/src/search_initializer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use bios_basic::spi::{api::spi_ci_bs_api, dto::spi_bs_dto::SpiBsCertResp, spi_constants, spi_funs::SpiBsInst, spi_initializer};
use tardis::{
basic::{dto::TardisContext, result::TardisResult},
tokio,
web::web_server::TardisWebServer,
TardisFuns, TardisFunsInst, tokio,
TardisFuns, TardisFunsInst,
};

use crate::{api::ci::search_ci_item_api, search_config::SearchConfig, search_constants::DOMAIN_CODE, serv};
Expand Down
6 changes: 5 additions & 1 deletion support/iam/src/basic/serv/iam_rel_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,16 @@ impl IamRelServ {
.filter(|r| r != res_other_id)
.collect::<Vec<String>>();
// 5) If these associated resources are explicitly associated with API resources, they cannot be removed
let mut res_bound = false;
for rel_res_id in rel_res_ids {
if rel_api_res_ids.contains(&rel_res_id) {
res_bound = true;
break;
}
}
remove_role_ids.push(rel_role_id);
if !res_bound {
remove_role_ids.push(rel_role_id);
}
}
// 6) Remove API resources from binding to roles in the cache
IamResCacheServ::delete_res_rel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ use crate::{
iam_filer_dto::IamAccountFilterReq,
},
serv::{
clients::{iam_log_client::LogParamTag, iam_search_client::IamSearchClient}, iam_account_serv::IamAccountServ, iam_platform_serv::IamPlatformServ, iam_rel_serv::IamRelServ, iam_tenant_serv::IamTenantServ,
clients::{iam_log_client::LogParamTag, iam_search_client::IamSearchClient},
iam_account_serv::IamAccountServ,
iam_platform_serv::IamPlatformServ,
iam_rel_serv::IamRelServ,
iam_tenant_serv::IamTenantServ,
},
},
iam_config::{IamBasicConfigApi, IamConfig},
Expand Down

0 comments on commit 7bf8401

Please sign in to comment.