diff --git a/support/iam/src/basic/serv/iam_account_serv.rs b/support/iam/src/basic/serv/iam_account_serv.rs index e666ce064..8e1c45bbd 100644 --- a/support/iam/src/basic/serv/iam_account_serv.rs +++ b/support/iam/src/basic/serv/iam_account_serv.rs @@ -502,7 +502,7 @@ impl IamAccountServ { let account_attr_values = IamAttrServ::find_account_attr_values(&account.id, funs, ctx).await?; let org_set_id = IamSetServ::get_set_id_by_code(&IamSetServ::get_default_code(&IamSetKind::Org, &ctx.own_paths), false, funs, ctx).await?; - let groups = IamSetServ::find_flat_set_items(&org_set_id, &account.id, false, funs, ctx).await?; + let groups = IamSetServ::find_flat_set_items(&org_set_id, &account.id, false, funs, &mock_tenant_ctx).await?; let account = IamAccountDetailAggResp { id: account.id.clone(), name: account.name, @@ -568,24 +568,12 @@ impl IamAccountServ { ) -> TardisResult> { let accounts = IamAccountServ::paginate_items(filter, page_number, page_size, desc_sort_by_create, desc_sort_by_update, funs, ctx).await?; let mut account_aggs = Vec::with_capacity(accounts.total_size as usize); - let mock_ctx = if use_sys_org { - ctx.clone() - } else { - TardisContext { - own_paths: IamTenantServ::get_id_by_ctx(ctx, funs)?, - ..ctx.clone() - } - }; + let mut mock_tenant_ctx = ctx.clone(); + mock_tenant_ctx.own_paths = IamTenantServ::get_id_by_ctx(ctx, funs)?; let set_id = if use_sys_org { IamSetServ::get_set_id_by_code(&IamSetServ::get_default_code(&IamSetKind::Org, ""), true, funs, ctx).await? } else { - IamSetServ::get_set_id_by_code( - &IamSetServ::get_default_code(&IamSetKind::Org, &IamTenantServ::get_id_by_ctx(ctx, funs)?), - true, - funs, - &mock_ctx, - ) - .await? + IamSetServ::get_set_id_by_code(&IamSetServ::get_default_code(&IamSetKind::Org, &IamTenantServ::get_id_by_ctx(ctx, funs)?), true, funs, &ctx).await? // IamSetServ::get_default_set_id_by_ctx(&IamSetKind::Org, funs, ctx).await? }; for account in accounts.records { @@ -629,7 +617,7 @@ impl IamAccountServ { .into_iter() .map(|r| (r.rel_rbum_cert_conf_code.unwrap_or("".to_string()), r.ak)) .collect(), - orgs: IamSetServ::find_set_paths(&account.id, &set_id, funs, ctx).await?.into_iter().map(|r| r.into_iter().map(|rr| rr.name).join("/")).collect(), + orgs: IamSetServ::find_set_paths(&account.id, &set_id, funs, &mock_tenant_ctx).await?.into_iter().map(|r| r.into_iter().map(|rr| rr.name).join("/")).collect(), }); } Ok(TardisPage {