Merge pull request '🌚防止pwdLastSet为null时报错' (#197) from KaneLeung/Admin.NET.Pro:main into main
Reviewed-on: http://101.43.53.74:3000/Admin.NET/Admin.NET.Pro/pulls/197
This commit is contained in:
commit
765b4f55ef
@ -36,7 +36,7 @@ public class SysLdap : EntityTenant
|
||||
/// <summary>
|
||||
/// 绑定DN(有管理权限制的用户)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "绑定DN", Length = 32)]
|
||||
[SugarColumn(ColumnDescription = "绑定DN", Length = 128)]
|
||||
[Required]
|
||||
public virtual string BindDn { get; set; }
|
||||
|
||||
|
||||
@ -266,15 +266,15 @@ public class SysLdapService : IDynamicApiController, ITransient
|
||||
{
|
||||
var userLdap = new SysUserLdap
|
||||
{
|
||||
Account = !attrs.ContainsKey(bindAttrAccount) ? null : attrs.GetAttribute(bindAttrAccount)?.StringValue,
|
||||
EmployeeId = !attrs.ContainsKey(bindAttrEmployeeId) ? null : attrs.GetAttribute(bindAttrEmployeeId)?.StringValue,
|
||||
Account = attrs.ContainsKey(bindAttrAccount) ? attrs.GetAttribute(bindAttrAccount)?.StringValue : null,
|
||||
EmployeeId = attrs.ContainsKey(bindAttrEmployeeId) ? attrs.GetAttribute(bindAttrEmployeeId)?.StringValue : null,
|
||||
DeptCode = deptCode,
|
||||
UserName = !attrs.ContainsKey("name") ? null : attrs.GetAttribute("name")?.StringValue,
|
||||
Mail = !attrs.ContainsKey("mail") ? null : attrs.GetAttribute("mail")?.StringValue
|
||||
UserName = attrs.ContainsKey("name") ? attrs.GetAttribute("name")?.StringValue : null,
|
||||
Mail = attrs.ContainsKey("mail") ? attrs.GetAttribute("mail")?.StringValue : null
|
||||
};
|
||||
var pwdLastSet = !attrs.ContainsKey("pwdLastSet") ? null : attrs.GetAttribute("pwdLastSet")?.StringValue;
|
||||
if (!pwdLastSet!.Equals("0")) userLdap.PwdLastSetTime = DateTime.FromFileTime(Convert.ToInt64(pwdLastSet));
|
||||
var userAccountControl = !attrs.ContainsKey("userAccountControl") ? null : attrs.GetAttribute("userAccountControl")?.StringValue;
|
||||
var pwdLastSet = attrs.ContainsKey("pwdLastSet") ? attrs.GetAttribute("pwdLastSet")?.StringValue : null;
|
||||
if (pwdLastSet != null && !pwdLastSet.Equals("0")) userLdap.PwdLastSetTime = DateTime.FromFileTime(Convert.ToInt64(pwdLastSet));
|
||||
var userAccountControl = attrs.ContainsKey("userAccountControl") ? attrs.GetAttribute("userAccountControl")?.StringValue : null;
|
||||
if ((Convert.ToInt32(userAccountControl) & 0x2) == 0x2) // 检查账户是否已过期(通过检查userAccountControl属性的特定位)
|
||||
userLdap.AccountExpiresFlag = true;
|
||||
if ((Convert.ToInt32(userAccountControl) & 0x10000) == 0x10000) // 检查账户密码设置是否永不过期
|
||||
@ -428,9 +428,9 @@ public class SysLdapService : IDynamicApiController, ITransient
|
||||
{
|
||||
Pid = org.Id,
|
||||
Id = YitIdHelper.NextId(),
|
||||
Code = !attrs.ContainsKey(sysLdap.BindAttrCode) ? null : new Guid(attrs.GetAttribute(sysLdap.BindAttrCode)?.ByteValue).ToString(),
|
||||
Code = attrs.ContainsKey(sysLdap.BindAttrCode) ? new Guid(attrs.GetAttribute(sysLdap.BindAttrCode)?.ByteValue).ToString() : null,
|
||||
Level = org.Level + 1,
|
||||
Name = !attrs.ContainsKey(sysLdap.BindAttrAccount) ? null : attrs.GetAttribute(sysLdap.BindAttrAccount)?.StringValue,
|
||||
Name = attrs.ContainsKey(sysLdap.BindAttrAccount) ? attrs.GetAttribute(sysLdap.BindAttrAccount)?.StringValue : null,
|
||||
OrderNo = listOrgs.Count + 1,
|
||||
};
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="绑定DN" prop="bindDn">
|
||||
<el-input v-model="formData.bindDn" placeholder="请输入绑定DN" maxlength="32" show-word-limit clearable />
|
||||
<el-input v-model="formData.bindDn" placeholder="请输入绑定DN" maxlength="128" show-word-limit clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user