Skip to content

Commit

Permalink
iam: add api:build res tree (#816)
Browse files Browse the repository at this point in the history
Co-authored-by: ZzIsGod1019 <1498852723@11.com>
  • Loading branch information
ZzIsGod1019 and ZzIsGod1019 authored Jul 30, 2024
1 parent 709012e commit c0b4801
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/middlewares/flow/src/serv/flow_model_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,7 @@ impl FlowModelServ {
// 2、template_id为单元素数组,则表示
pub async fn check_post_action_ring(model_desp: &FlowModelDetailResp, funs: &TardisFunsInst, ctx: &TardisContext) -> TardisResult<bool> {
let mut model_details = HashMap::new();
if model_desp.template && model_desp.rel_model_id.is_empty() {
if model_desp.template {
model_details.insert(model_desp.tag.clone(), model_desp.clone());
} else {
let template_ids = if model_desp.rel_template_ids.is_empty() {
Expand Down
14 changes: 13 additions & 1 deletion backend/supports/iam/src/console_common/api/iam_cc_res_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::basic::serv::iam_set_serv::IamSetServ;
use crate::iam_constants;
use crate::iam_enumeration::IamSetKind;
use bios_basic::helper::request_helper::try_set_real_ip_from_req_to_ctx;
use bios_basic::rbum::dto::rbum_set_dto::RbumSetTreeResp;
use bios_basic::rbum::dto::rbum_set_dto::{RbumSetTreeCateResp, RbumSetTreeResp};
use tardis::web::context_extractor::TardisContextExtractor;
use tardis::web::poem::web::Json;
use tardis::web::poem::Request;
Expand All @@ -33,6 +33,18 @@ impl IamCcResApi {
TardisResp::ok(result)
}

/// build Menu Tree
/// 构造菜单树
#[oai(path = "/tree/build", method = "get")]
async fn build_menu_tree(&self, ctx: TardisContextExtractor, request: &Request) -> TardisApiResult<RbumSetTreeCateResp> {
try_set_real_ip_from_req_to_ctx(request, &ctx.0).await?;
let funs = iam_constants::get_tardis_inst();
let set_id = IamSetServ::get_set_id_by_code(&IamSetServ::get_default_code(&IamSetKind::Res, ""), true, &funs, &ctx.0).await?;
let result = IamSetServ::get_menu_tree_by_roles(&set_id, &ctx.0.roles, &funs, &ctx.0).await?;
ctx.0.execute_task().await?;
TardisResp::ok(result.to_trees())
}

/// Find res by apps
/// 根据应用查找资源
#[oai(path = "/res", method = "get")]
Expand Down

0 comments on commit c0b4801

Please sign in to comment.