Skip to content

Commit

Permalink
iam:fix search account.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljl committed Aug 1, 2024
1 parent f0d891e commit 89a2945
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions backend/supports/iam/src/basic/serv/clients/iam_search_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,8 @@ impl IamSearchClient {
if *is_modify {
let modify_req = SearchItemModifyReq {
kind: Some(funs.conf::<IamConfig>().spi.search_account_tag.clone()),
title: if account_resp.disabled {
Some(format!("{}(已注销)", account_resp.name.clone()))
} else {
Some(account_resp.name.clone())
},
name: if account_resp.disabled {
Some(format!("{}(已注销)", account_resp.name.clone()))
} else {
Some(account_resp.name.clone())
},
title: Some(account_resp.name.clone()),
name: Some(account_resp.name.clone()),
content: Some(format!("{},{:?}", account_resp.name, account_certs,)),
owner: Some(account_resp.owner),
own_paths: if !account_resp.own_paths.is_empty() {
Expand Down Expand Up @@ -196,16 +188,11 @@ impl IamSearchClient {
SpiSearchClient::modify_item_and_name(&tag, &key, &modify_req, funs, ctx).await?;
}
} else {
let name = if account_resp.disabled {
format!("{}(已注销)", account_resp.name.clone())
} else {
account_resp.name.clone()
};
let add_req = SearchItemAddReq {
tag,
kind: funs.conf::<IamConfig>().spi.search_account_tag.clone(),
key: TrimString(key),
title: name.clone(),
title: account_resp.name.clone(),
content: format!("{},{:?}", account_resp.name, account_certs,),
owner: Some(account_resp.owner),
own_paths: if !account_resp.own_paths.is_empty() {
Expand Down Expand Up @@ -242,9 +229,9 @@ impl IamSearchClient {
kv_disable: Some(account_resp.disabled),
};
if let Some(event_center) = BiosEventCenter::worker_queue() {
event_center.add_item_and_name(IAM_AVATAR, &add_req, Some(name), funs, ctx).await?;
event_center.add_item_and_name(IAM_AVATAR, &add_req, Some(account_resp.name), funs, ctx).await?;
} else {
SpiSearchClient::add_item_and_name(&add_req, Some(name), funs, ctx).await?;
SpiSearchClient::add_item_and_name(&add_req, Some(account_resp.name), funs, ctx).await?;
}
}
Ok(())
Expand Down

0 comments on commit 89a2945

Please sign in to comment.