DurnyklyYol/DurnyklyYol.Module/BusinessObjects/ApplicationUser.cs

56 lines
1.8 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 {
2024-09-26 06:06:05 +00:00
bool suspended;
2024-09-02 10:07:25 +00:00
private int accessFailedCount;
private DateTime lockoutEnd;
public ApplicationUser(Session session) : base(session) { }
[Browsable(false)]
2024-09-26 06:06:05 +00:00
public int AccessFailedCount
{
2024-09-02 10:07:25 +00:00
get { return accessFailedCount; }
set { SetPropertyValue(nameof(AccessFailedCount), ref accessFailedCount, value); }
}
[Browsable(false)]
2024-09-26 06:06:05 +00:00
public DateTime LockoutEnd
{
2024-09-02 10:07:25 +00:00
get { return lockoutEnd; }
set { SetPropertyValue(nameof(LockoutEnd), ref lockoutEnd, value); }
}
[Browsable(false)]
[Aggregated, Association("User-LoginInfo")]
2024-09-26 06:06:05 +00:00
public XPCollection<ApplicationUserLoginInfo> LoginInfo
{
2024-09-02 10:07:25 +00:00
get { return GetCollection<ApplicationUserLoginInfo>(nameof(LoginInfo)); }
}
IEnumerable<ISecurityUserLoginInfo> IOAuthSecurityUser.UserLogins => LoginInfo.OfType<ISecurityUserLoginInfo>();
2024-09-26 06:06:05 +00:00
ISecurityUserLoginInfo ISecurityUserWithLoginInfo.CreateUserLoginInfo(string loginProviderName, string providerUserKey)
{
2024-09-02 10:07:25 +00:00
ApplicationUserLoginInfo result = new ApplicationUserLoginInfo(Session);
result.LoginProviderName = loginProviderName;
result.ProviderUserKey = providerUserKey;
result.User = this;
return result;
}
2024-09-26 06:06:05 +00:00
public bool Suspended
{
get => suspended;
set => SetPropertyValue(nameof(Suspended), ref suspended, value);
}
2024-09-02 10:07:25 +00:00
}