Skip to content

Commit

Permalink
flow: fix update name when states are modified (#789)
Browse files Browse the repository at this point in the history
* iam-account:fix bug modify labor_type

* flow: fix update name when states are modified

* iam: fix ldap sync
  • Loading branch information
ZzIsGod1019 authored Jun 27, 2024
1 parent 984c4b6 commit deb0bcb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
21 changes: 0 additions & 21 deletions backend/middlewares/flow/src/serv/flow_model_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,24 +200,20 @@ impl RbumItemCrudOperation<flow_model::ActiveModel, FlowModelAddReq, FlowModelMo

async fn after_modify_item(flow_model_id: &str, modify_req: &mut FlowModelModifyReq, funs: &TardisFunsInst, ctx: &TardisContext) -> TardisResult<()> {
let model_detail = Self::get_item(flow_model_id, &FlowModelFilterReq::default(), funs, ctx).await?;
let mut refresh_model_name_by_sorted_states = false;
if let Some(bind_states) = &modify_req.bind_states {
for bind_state in bind_states {
Self::bind_state(flow_model_id, bind_state, funs, ctx).await?;
}
refresh_model_name_by_sorted_states = true;
}
if let Some(unbind_states) = &modify_req.unbind_states {
for unbind_state in unbind_states {
Self::unbind_state(flow_model_id, unbind_state, funs, ctx).await?;
}
refresh_model_name_by_sorted_states = true;
}
if let Some(modify_states) = &modify_req.modify_states {
for modify_state in modify_states {
Self::modify_rel_state_ext(flow_model_id, modify_state, funs, ctx).await?;
}
refresh_model_name_by_sorted_states = true;
}
if let Some(add_transitions) = &modify_req.add_transitions {
Self::add_transitions(flow_model_id, add_transitions, funs, ctx).await?;
Expand Down Expand Up @@ -264,9 +260,6 @@ impl RbumItemCrudOperation<flow_model::ActiveModel, FlowModelAddReq, FlowModelMo
}
}
}
if refresh_model_name_by_sorted_states {
Self::refresh_model_name_by_sorted_states(flow_model_id, funs, ctx).await?;
}
let model = Self::get_item_detail_aggs(flow_model_id, false, funs, ctx).await?;
if model.template && model.rel_model_id.is_empty() {
IamSearchClient::async_add_or_modify_model_search(flow_model_id, Box::new(true), funs, ctx).await?;
Expand Down Expand Up @@ -1560,18 +1553,4 @@ impl FlowModelServ {
None => Err(funs.err().not_found("flow_inst_serv", "get_model_id_by_own_paths", "model not found", "404-flow-model-not-found")),
}
}

async fn refresh_model_name_by_sorted_states(flow_model_id: &str, funs: &TardisFunsInst, ctx: &TardisContext) -> TardisResult<()> {
Self::modify_item(
flow_model_id,
&mut FlowModelModifyReq {
name: Some(Self::find_sorted_rel_states_by_model_id(flow_model_id, funs, ctx).await?.into_iter().map(|state| state.name).collect_vec().join("-").into()),
..Default::default()
},
funs,
ctx,
)
.await?;
Ok(())
}
}
1 change: 1 addition & 0 deletions backend/supports/iam/src/basic/dto/iam_cert_conf_dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ impl IamCertConfLdapResp {
&self.account_field_map.field_display_name,
&self.account_field_map.field_email,
&self.account_field_map.field_mobile,
&self.account_field_map.field_labor_type,
];
[vec, vec1].concat()
}
Expand Down

0 comments on commit deb0bcb

Please sign in to comment.