Skip to content

Commit

Permalink
iam:fix org.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljl committed Jan 27, 2024
1 parent 8f1fefb commit c8a93bf
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions support/iam/src/basic/serv/iam_account_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -568,24 +568,12 @@ impl IamAccountServ {
) -> TardisResult<TardisPage<IamAccountSummaryAggResp>> {
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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c8a93bf

Please sign in to comment.