Skip to content

Commit bc0b950

Browse files
committed
😎代码整理优化
1 parent c91dca8 commit bc0b950

File tree

10 files changed

+48
-47
lines changed

10 files changed

+48
-47
lines changed

Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<PackageReference Include="Novell.Directory.Ldap.NETStandard" Version="3.6.0" />
3939
<PackageReference Include="OnceMi.AspNetCore.OSS" Version="1.1.9" />
4040
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
41-
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.1" />
41+
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.2" />
4242
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.0.0" />
4343
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.2.0" />
4444
<PackageReference Include="SqlSugarCore" Version="5.1.4.152" />

Admin.NET/Admin.NET.Core/Entity/SysUserLdap.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,18 @@ public class SysUserLdap : EntityTenant
2929
/// Ldap对应uid
3030
/// </summary>
3131
[SugarColumn(ColumnDescription = "域账号", Length = 32)]
32+
[Required]
3233
public string Account { get; set; }
3334

3435
/// <summary>
3536
/// 对应EmployeeId(用于数据导入对照)
3637
/// </summary>
3738
[SugarColumn(ColumnDescription = "对应EmployeeId", Length = 32)]
38-
public string EmployeeId { get; set; }
39+
public string? EmployeeId { get; set; }
3940

4041
/// <summary>
4142
/// 组织代码
4243
/// </summary>
43-
[SugarColumn(ColumnDescription = "DeptCode", Length = 64)]
44-
public string DeptCode { get; set; }
44+
[SugarColumn(ColumnDescription = "组织代码", Length = 64)]
45+
public string? DeptCode { get; set; }
4546
}

Admin.NET/Admin.NET.Core/Service/Auth/SysLdapService.cs

+9-8
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,14 @@ public async Task SyncUser(SyncSysLdapInput input)
186186
}
187187

188188
var attrs = ldapEntry.GetAttributeSet();
189-
string deptCode = GetDepartmentCode(attrs, sysLdap.BindAttrCode);
189+
var deptCode = GetDepartmentCode(attrs, sysLdap.BindAttrCode);
190190
if (attrs.Count == 0 || attrs.ContainsKey("OU"))
191+
{
191192
SearchDnLdapUser(ldapConn, sysLdap, userLdapList, ldapEntry.Dn, deptCode);
193+
}
192194
else
193195
{
194196
var sysUserLdap = CreateSysUserLdap(attrs, sysLdap.BindAttrAccount, sysLdap.BindAttrEmployeeId, deptCode);
195-
196197
if (string.IsNullOrEmpty(sysUserLdap.EmployeeId)) continue;
197198
userLdapList.Add(sysUserLdap);
198199
}
@@ -302,7 +303,7 @@ public async Task SyncDept(SyncSysLdapInput input)
302303
ldapConn.Connect(sysLdap.Host, sysLdap.Port);
303304
ldapConn.Bind(sysLdap.Version, sysLdap.BindDn, sysLdap.BindPass);
304305
var ldapSearchResults = ldapConn.Search(sysLdap.BaseDn, LdapConnection.ScopeOne, "(objectClass=*)", null, false);
305-
var listOrgs = new List<SysOrg>();
306+
var orgList = new List<SysOrg>();
306307
while (ldapSearchResults.HasMore())
307308
{
308309
LdapEntry ldapEntry;
@@ -319,17 +320,17 @@ public async Task SyncDept(SyncSysLdapInput input)
319320
var attrs = ldapEntry.GetAttributeSet();
320321
if (attrs.Count == 0 || attrs.ContainsKey("OU"))
321322
{
322-
var sysOrg = CreateSysOrg(attrs, sysLdap, listOrgs, new SysOrg { Id = 0, Level = 0 });
323-
listOrgs.Add(sysOrg);
323+
var sysOrg = CreateSysOrg(attrs, sysLdap, orgList, new SysOrg { Id = 0, Level = 0 });
324+
orgList.Add(sysOrg);
324325

325-
SearchDnLdapDept(ldapConn, sysLdap, listOrgs, ldapEntry.Dn, sysOrg);
326+
SearchDnLdapDept(ldapConn, sysLdap, orgList, ldapEntry.Dn, sysOrg);
326327
}
327328
}
328329

329-
if (listOrgs.Count == 0)
330+
if (orgList.Count == 0)
330331
return;
331332

332-
await App.GetRequiredService<SysOrgService>().BatchAddOrgs(listOrgs);
333+
await App.GetRequiredService<SysOrgService>().BatchAddOrgs(orgList);
333334
}
334335
catch (LdapException e)
335336
{

Admin.NET/Admin.NET.Core/Service/Org/SysOrgService.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ public async Task<long> AddOrg(AddOrgInput input)
132132
/// <summary>
133133
/// 批量增加机构
134134
/// </summary>
135-
/// <param name="list"></param>
135+
/// <param name="orgs"></param>
136136
/// <returns></returns>
137137
[NonAction]
138-
public async Task BatchAddOrgs(List<SysOrg> list)
138+
public async Task BatchAddOrgs(List<SysOrg> orgs)
139139
{
140140
DeleteAllUserOrgCache(0, 0);
141141
await _sysOrgRep.AsDeleteable().ExecuteCommandAsync();
142-
await _sysOrgRep.AsInsertable(list).ExecuteCommandAsync();
142+
await _sysOrgRep.AsInsertable(orgs).ExecuteCommandAsync();
143143
}
144144

145145
/// <summary>

Web/src/api-services/apis/sys-ldap-api.ts

+24-24
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,13 @@ export const SysLdapApiAxiosParamCreator = function (configuration?: Configurati
273273
},
274274
/**
275275
*
276-
* @summary 同步域用户 🔖
276+
* @summary 同步域组织 🔖
277277
* @param {SyncSysLdapInput} [body]
278278
* @param {*} [options] Override http request option.
279279
* @throws {RequiredError}
280280
*/
281-
apiSysLdapSyncUserPost: async (body?: SyncSysLdapInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
282-
const localVarPath = `/api/sysLdap/syncUser`;
281+
apiSysLdapSyncDeptPost: async (body?: SyncSysLdapInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
282+
const localVarPath = `/api/sysLdap/syncDept`;
283283
// use dummy base URL string because the URL constructor only accepts absolute URLs.
284284
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
285285
let baseOptions;
@@ -321,13 +321,13 @@ export const SysLdapApiAxiosParamCreator = function (configuration?: Configurati
321321
},
322322
/**
323323
*
324-
* @summary 同步域组织 🔖
324+
* @summary 同步域用户 🔖
325325
* @param {SyncSysLdapInput} [body]
326326
* @param {*} [options] Override http request option.
327327
* @throws {RequiredError}
328328
*/
329-
apiSysLdapSyncOrgPost: async (body?: SyncSysLdapInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
330-
const localVarPath = `/api/sysLdap/syncOrg`;
329+
apiSysLdapSyncUserPost: async (body?: SyncSysLdapInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
330+
const localVarPath = `/api/sysLdap/syncUser`;
331331
// use dummy base URL string because the URL constructor only accepts absolute URLs.
332332
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
333333
let baseOptions;
@@ -495,27 +495,27 @@ export const SysLdapApiFp = function(configuration?: Configuration) {
495495
},
496496
/**
497497
*
498-
* @summary 同步域用户 🔖
498+
* @summary 同步域组织 🔖
499499
* @param {SyncSysLdapInput} [body]
500500
* @param {*} [options] Override http request option.
501501
* @throws {RequiredError}
502502
*/
503-
async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
504-
const localVarAxiosArgs = await SysLdapApiAxiosParamCreator(configuration).apiSysLdapSyncUserPost(body, options);
503+
async apiSysLdapSyncDeptPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
504+
const localVarAxiosArgs = await SysLdapApiAxiosParamCreator(configuration).apiSysLdapSyncDeptPost(body, options);
505505
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
506506
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
507507
return axios.request(axiosRequestArgs);
508508
};
509509
},
510510
/**
511511
*
512-
* @summary 同步域组织 🔖
512+
* @summary 同步域用户 🔖
513513
* @param {SyncSysLdapInput} [body]
514514
* @param {*} [options] Override http request option.
515515
* @throws {RequiredError}
516516
*/
517-
async apiSysLdapSyncOrgPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
518-
const localVarAxiosArgs = await SysLdapApiAxiosParamCreator(configuration).apiSysLdapSyncOrgPost(body, options);
517+
async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
518+
const localVarAxiosArgs = await SysLdapApiAxiosParamCreator(configuration).apiSysLdapSyncUserPost(body, options);
519519
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
520520
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
521521
return axios.request(axiosRequestArgs);
@@ -595,23 +595,23 @@ export const SysLdapApiFactory = function (configuration?: Configuration, basePa
595595
},
596596
/**
597597
*
598-
* @summary 同步域用户 🔖
598+
* @summary 同步域组织 🔖
599599
* @param {SyncSysLdapInput} [body]
600600
* @param {*} [options] Override http request option.
601601
* @throws {RequiredError}
602602
*/
603-
async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
604-
return SysLdapApiFp(configuration).apiSysLdapSyncUserPost(body, options).then((request) => request(axios, basePath));
603+
async apiSysLdapSyncDeptPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
604+
return SysLdapApiFp(configuration).apiSysLdapSyncDeptPost(body, options).then((request) => request(axios, basePath));
605605
},
606606
/**
607607
*
608-
* @summary 同步域组织 🔖
608+
* @summary 同步域用户 🔖
609609
* @param {SyncSysLdapInput} [body]
610610
* @param {*} [options] Override http request option.
611611
* @throws {RequiredError}
612612
*/
613-
async apiSysLdapSyncOrgPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
614-
return SysLdapApiFp(configuration).apiSysLdapSyncOrgPost(body, options).then((request) => request(axios, basePath));
613+
async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
614+
return SysLdapApiFp(configuration).apiSysLdapSyncUserPost(body, options).then((request) => request(axios, basePath));
615615
},
616616
/**
617617
*
@@ -689,25 +689,25 @@ export class SysLdapApi extends BaseAPI {
689689
}
690690
/**
691691
*
692-
* @summary 同步域用户 🔖
692+
* @summary 同步域组织 🔖
693693
* @param {SyncSysLdapInput} [body]
694694
* @param {*} [options] Override http request option.
695695
* @throws {RequiredError}
696696
* @memberof SysLdapApi
697697
*/
698-
public async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
699-
return SysLdapApiFp(this.configuration).apiSysLdapSyncUserPost(body, options).then((request) => request(this.axios, this.basePath));
698+
public async apiSysLdapSyncDeptPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
699+
return SysLdapApiFp(this.configuration).apiSysLdapSyncDeptPost(body, options).then((request) => request(this.axios, this.basePath));
700700
}
701701
/**
702702
*
703-
* @summary 同步域组织 🔖
703+
* @summary 同步域用户 🔖
704704
* @param {SyncSysLdapInput} [body]
705705
* @param {*} [options] Override http request option.
706706
* @throws {RequiredError}
707707
* @memberof SysLdapApi
708708
*/
709-
public async apiSysLdapSyncOrgPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
710-
return SysLdapApiFp(this.configuration).apiSysLdapSyncOrgPost(body, options).then((request) => request(this.axios, this.basePath));
709+
public async apiSysLdapSyncUserPost(body?: SyncSysLdapInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
710+
return SysLdapApiFp(this.configuration).apiSysLdapSyncUserPost(body, options).then((request) => request(this.axios, this.basePath));
711711
}
712712
/**
713713
*

Web/src/api-services/models/sys-ldap.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export interface SysLdap {
169169
* 绑定Code属性值
170170
*
171171
* @type {string}
172-
* @memberof AddSysLdapInput
172+
* @memberof SysLdap
173173
*/
174174
bindAttrCode: string;
175175

Web/src/api-services/models/update-sys-ldap-input.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export interface UpdateSysLdapInput {
169169
* 绑定Code属性值
170170
*
171171
* @type {string}
172-
* @memberof AddSysLdapInput
172+
* @memberof UpdateSysLdapInput
173173
*/
174174
bindAttrCode: string;
175175

Web/src/layout/lockScreen/index.vue

-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ const onLockScreenSubmit = async () => {
194194
if (state.lockScreenPassword) {
195195
try {
196196
// SM2加密密码
197-
// const keys = SM2.generateKeyPair();
198197
const publicKey = window.__env__.VITE_SM_PUBLIC_KEY;
199198
const password = sm2.doEncrypt(state.lockScreenPassword, publicKey, 1);
200199
const [err, res] = await feature(getAPI(SysAuthApi).apiSysAuthUnLockScreenPost(password));

Web/src/views/system/ldap/component/editLdap.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
</el-form-item>
2121
</el-col>
2222
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
23-
<el-form-item label="用户搜索基准" prop="baseDn">
23+
<el-form-item label="搜索基准" prop="baseDn">
2424
<el-input v-model="state.ruleForm.baseDn" placeholder="请输入用户搜索基准" maxlength="128" show-word-limit clearable />
2525
</el-form-item>
2626
</el-col>
2727
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
28-
<el-form-item label="用户过滤规则" prop="authFilter">
28+
<el-form-item label="过滤规则" prop="authFilter">
2929
<el-input v-model="state.ruleForm.authFilter" placeholder="请输入用户过滤规则" maxlength="128" show-word-limit clearable />
3030
</el-form-item>
3131
</el-col>
@@ -40,12 +40,12 @@
4040
</el-form-item>
4141
</el-col>
4242
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
43-
<el-form-item label="绑定账号属性" prop="bindAttrAccount">
43+
<el-form-item label="字段属性" prop="bindAttrAccount">
4444
<el-input v-model="state.ruleForm.bindAttrAccount" placeholder="请输入域账号字段属性值" maxlength="24" show-word-limit clearable />
4545
</el-form-item>
4646
</el-col>
4747
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
48-
<el-form-item label="绑定账号属性" prop="bindAttrEmployeeId">
48+
<el-form-item label="用户属性" prop="bindAttrEmployeeId">
4949
<el-input v-model="state.ruleForm.bindAttrEmployeeId" placeholder="请输入绑定用户EmployeeId属性!" maxlength="24" show-word-limit clearable />
5050
</el-form-item>
5151
</el-col>

Web/src/views/system/ldap/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<ModifyRecord :data="scope.row" />
4242
</template>
4343
</el-table-column>
44-
<el-table-column label="操作" width="240" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('sysLdap:update') || auth('sysLdap:delete') || auth('sysLdap:syncUser') || auth('sysLdap:syncOrg')">
44+
<el-table-column label="操作" width="300" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('sysLdap:update') || auth('sysLdap:delete') || auth('sysLdap:syncUser') || auth('sysLdap:syncOrg')">
4545
<template #default="scope">
4646
<el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditSysLdap(scope.row)" v-auth="'sysLdap:update'"> 编辑 </el-button>
4747
<el-button icon="ele-Delete" size="small" text type="danger" @click="delSysLdap(scope.row)" v-auth="'sysLdap:delete'"> 删除 </el-button>

0 commit comments

Comments
 (0)