Skip to content

Commit

Permalink
iam: find accounts support filter app_ids (#834)
Browse files Browse the repository at this point in the history
* iam: find accounts support filter app_ids

* iam:fix bug (move rbum set cate )

---------

Co-authored-by: ZzIsGod1019 <[email protected]>
  • Loading branch information
ZzIsGod1019 and ZzIsGod1019 authored Aug 26, 2024
1 parent 2d468b4 commit f68b1d8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
41 changes: 13 additions & 28 deletions backend/basic/src/rbum/serv/rbum_set_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,18 @@ impl RbumSetCateServ {
ctx,
)
.await?;

let set_item_ids = RbumSetItemServ::find_id_rbums(
&RbumSetItemFilterReq {
sys_code_query_kind: Some(RbumSetCateLevelQueryKind::Current),
rel_rbum_set_cate_sys_codes: Some(vec![set_cate_detail.sys_code.clone()]),
..Default::default()
},
None,
None,
funs,
ctx,
)
.await?;
let result = Self::modify_rbum(
set_cate_id,
&mut RbumSetCateModifyReq {
Expand All @@ -867,37 +878,11 @@ impl RbumSetCateServ {
ctx,
)
.await;
let new_sys_code = Self::get_rbum(
set_cate_id,
&RbumSetCateFilterReq {
basic: RbumBasicFilterReq {
with_sub_own_paths: true,
..Default::default()
},
..Default::default()
},
funs,
ctx,
)
.await?
.sys_code;
let set_item_ids = RbumSetItemServ::find_id_rbums(
&RbumSetItemFilterReq {
sys_code_query_kind: Some(RbumSetCateLevelQueryKind::Current),
rel_rbum_set_cate_sys_codes: Some(vec![]),
..Default::default()
},
None,
None,
funs,
ctx,
)
.await?;
for set_item_id in set_item_ids {
RbumSetItemServ::modify_rbum(
&set_item_id,
&mut RbumSetItemModifyReq {
rel_rbum_set_cate_id: Some(new_sys_code.clone()),
rel_rbum_set_cate_id: Some(set_cate_id.to_string()),
sort: None,
},
funs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl IamCiAccountApi {
ids: Query<Option<String>>,
name: Query<Option<String>>,
role_ids: Query<Option<String>>,
app_ids: Query<Option<String>>,
cate_ids: Query<Option<String>>,
status: Query<Option<bool>>,
tenant_id: Query<Option<String>>,
Expand All @@ -67,6 +68,16 @@ impl IamCiAccountApi {
..Default::default()
}
});
let rel2 = app_ids.0.map(|app_ids| {
let app_ids = app_ids.split(',').map(|r| r.to_string()).collect::<Vec<_>>();
RbumItemRelFilterReq {
rel_by_from: true,
tag: Some(IamRelKind::IamAccountApp.to_string()),
from_rbum_kind: Some(RbumRelFromKind::Item),
rel_item_ids: Some(app_ids),
..Default::default()
}
});
let set_rel = if let Some(cate_ids) = cate_ids.0 {
let cate_ids = cate_ids.split(',').map(|r| r.to_string()).collect::<Vec<_>>();
let set_cate_vec = IamSetServ::find_set_cate(
Expand Down Expand Up @@ -108,6 +119,7 @@ impl IamCiAccountApi {
..Default::default()
},
rel,
rel2,
set_rel,
..Default::default()
},
Expand Down

0 comments on commit f68b1d8

Please sign in to comment.