Skip to content

Commit

Permalink
iam:fix split
Browse files Browse the repository at this point in the history
  • Loading branch information
ljl committed Nov 28, 2023
1 parent 69a2189 commit 6c39df2
Show file tree
Hide file tree
Showing 20 changed files with 6 additions and 1,332 deletions.
1 change: 0 additions & 1 deletion support/iam/src/console_common.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pub mod api;
pub mod serv;
2 changes: 0 additions & 2 deletions support/iam/src/console_common/api.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
pub mod iam_cc_account_api;
// todo remove
pub mod iam_cc_account_task_api;
pub mod iam_cc_app_api;
pub mod iam_cc_app_set_api;
pub mod iam_cc_config_api;
Expand Down
49 changes: 4 additions & 45 deletions support/iam/src/console_common/api/iam_cc_account_api.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
use bios_basic::helper::request_helper::add_remote_ip;
use tardis::web::context_extractor::TardisContextExtractor;
use tardis::web::poem::web::Json;
use tardis::web::poem::Request;
use tardis::web::poem_openapi;
use tardis::web::poem_openapi::param::Query;
use tardis::web::web_resp::{TardisApiResult, TardisPage, TardisResp};

use bios_basic::helper::request_helper::add_remote_ip;
use bios_basic::rbum::dto::rbum_filer_dto::{RbumBasicFilterReq, RbumItemRelFilterReq};
use bios_basic::rbum::rbum_enumeration::RbumRelFromKind;
use bios_basic::rbum::serv::rbum_item_serv::RbumItemCrudOperation;

use crate::basic::dto::iam_account_dto::{IamAccountAddByLdapResp, IamAccountBoneResp, IamAccountExtSysBatchAddReq, IamAccountExtSysResp};
use crate::basic::dto::iam_account_dto::IamAccountBoneResp;
use crate::basic::dto::iam_filer_dto::IamAccountFilterReq;
use crate::basic::serv::iam_account_serv::IamAccountServ;
#[cfg(feature = "ldap_client")]
use crate::basic::serv::iam_cert_ldap_serv::IamCertLdapServ;
use crate::iam_constants;
use crate::iam_enumeration::IamRelKind;

#[derive(Clone, Default)]
pub struct IamCcAccountApi;
#[derive(Clone, Default)]
pub struct IamCcAccountLdapApi;


/// Common Console Account API
#[poem_openapi::OpenApi(prefix_path = "/cc/account", tag = "bios_basic::ApiTag::Common")]
Expand Down Expand Up @@ -80,7 +76,7 @@ impl IamCcAccountApi {
&funs,
&ctx.0,
)
.await?;
.await?;
ctx.0.execute_task().await?;
TardisResp::ok(TardisPage {
page_size: result.page_size,
Expand Down Expand Up @@ -156,40 +152,3 @@ impl IamCcAccountApi {
}
}

/// Common Console Account LDAP API
#[cfg(feature = "ldap_client")]
#[poem_openapi::OpenApi(prefix_path = "/cc/account/ldap", tag = "bios_basic::ApiTag::Common")]
impl IamCcAccountLdapApi {
/// Find Accounts by LDAP
#[oai(path = "/", method = "get")]
async fn find_from_ldap(
&self,
name: Query<String>,
tenant_id: Query<Option<String>>,
code: Query<String>,
ctx: TardisContextExtractor,
request: &Request,
) -> TardisApiResult<Vec<IamAccountExtSysResp>> {
add_remote_ip(request, &ctx.0).await?;
let funs = iam_constants::get_tardis_inst();
let result = IamCertLdapServ::search_accounts(&name.0, tenant_id.0, &code.0, &funs, &ctx.0).await?;
ctx.0.execute_task().await?;
TardisResp::ok(result)
}

/// Add Account by LDAP
#[oai(path = "/", method = "put")]
async fn add_account_from_ldap(
&self,
add_req: Json<IamAccountExtSysBatchAddReq>,
tenant_id: Query<Option<String>>,
ctx: TardisContextExtractor,
request: &Request,
) -> TardisApiResult<IamAccountAddByLdapResp> {
add_remote_ip(request, &ctx.0).await?;
let funs = iam_constants::get_tardis_inst();
let result = IamCertLdapServ::batch_get_or_add_account_without_verify(add_req.0, tenant_id.0, &funs, &ctx.0).await?;
ctx.0.execute_task().await?;
TardisResp::ok(result)
}
}
55 changes: 0 additions & 55 deletions support/iam/src/console_common/api/iam_cc_account_task_api.rs

This file was deleted.

2 changes: 0 additions & 2 deletions support/iam/src/console_common/serv.rs

This file was deleted.

Loading

0 comments on commit 6c39df2

Please sign in to comment.