DurnyklyYol/DurnyklyYol.Module/BusinessObjects/ApplicationUser.cs

46 lines
1.6 KiB
C#
Raw Normal View History

2024-09-02 10:07:25 +00:00
using System.ComponentModel;
using System.Text;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Security;
using DevExpress.Persistent.BaseImpl.PermissionPolicy;
using DevExpress.Xpo;
namespace DurnyklyYol.Module.BusinessObjects;
[MapInheritance(MapInheritanceType.ParentTable)]
[DefaultProperty(nameof(UserName))]
public class ApplicationUser : PermissionPolicyUser, ISecurityUserWithLoginInfo, ISecurityUserLockout {
private int accessFailedCount;
private DateTime lockoutEnd;
public ApplicationUser(Session session) : base(session) { }
[Browsable(false)]
public int AccessFailedCount {
get { return accessFailedCount; }
set { SetPropertyValue(nameof(AccessFailedCount), ref accessFailedCount, value); }
}
[Browsable(false)]
public DateTime LockoutEnd {
get { return lockoutEnd; }
set { SetPropertyValue(nameof(LockoutEnd), ref lockoutEnd, value); }
}
[Browsable(false)]
[Aggregated, Association("User-LoginInfo")]
public XPCollection<ApplicationUserLoginInfo> LoginInfo {
get { return GetCollection<ApplicationUserLoginInfo>(nameof(LoginInfo)); }
}
IEnumerable<ISecurityUserLoginInfo> IOAuthSecurityUser.UserLogins => LoginInfo.OfType<ISecurityUserLoginInfo>();
ISecurityUserLoginInfo ISecurityUserWithLoginInfo.CreateUserLoginInfo(string loginProviderName, string providerUserKey) {
ApplicationUserLoginInfo result = new ApplicationUserLoginInfo(Session);
result.LoginProviderName = loginProviderName;
result.ProviderUserKey = providerUserKey;
result.User = this;
return result;
}
}