2012-11-05 14:42:21 -01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2012-11-09 19:54:10 -01:00
|
|
|
|
using System.Linq;
|
2012-11-09 14:45:28 -01:00
|
|
|
|
using Umbraco.Core.Models.EntityBase;
|
2012-11-05 14:42:21 -01:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Core.Models.Membership
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Represents a backoffice user
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>
|
|
|
|
|
|
/// Should be internal until a proper user/membership implementation
|
|
|
|
|
|
/// is part of the roadmap.
|
|
|
|
|
|
/// </remarks>
|
2012-11-09 14:45:28 -01:00
|
|
|
|
internal class User : UserProfile, IUser
|
2012-11-05 14:42:21 -01:00
|
|
|
|
{
|
2012-11-09 14:45:28 -01:00
|
|
|
|
private bool _hasIdentity;
|
|
|
|
|
|
private int _id;
|
|
|
|
|
|
|
2012-11-09 19:54:10 -01:00
|
|
|
|
public User(IUserType userType)
|
|
|
|
|
|
{
|
|
|
|
|
|
Groups = new List<object> {userType};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2012-11-09 14:45:28 -01:00
|
|
|
|
#region Implementation of IEntity
|
|
|
|
|
|
|
|
|
|
|
|
public bool HasIdentity { get { return Id != null || _hasIdentity; } }
|
|
|
|
|
|
|
|
|
|
|
|
int IEntity.Id
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2012-11-09 19:54:10 -01:00
|
|
|
|
return int.Parse(base.Id.ToString());
|
2012-11-09 14:45:28 -01:00
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
2012-11-09 19:54:10 -01:00
|
|
|
|
base.Id = value;
|
2012-11-09 14:45:28 -01:00
|
|
|
|
_hasIdentity = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Guid Key { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2012-11-05 14:42:21 -01:00
|
|
|
|
#region Implementation of IMembershipUser
|
|
|
|
|
|
|
|
|
|
|
|
public string Username { get; set; }
|
|
|
|
|
|
public string Email { get; set; }
|
|
|
|
|
|
public string Password { get; set; }
|
|
|
|
|
|
public string PasswordQuestion { get; set; }
|
|
|
|
|
|
public string PasswordAnswer { get; set; }
|
|
|
|
|
|
public string Comments { get; set; }
|
|
|
|
|
|
public bool IsApproved { get; set; }
|
|
|
|
|
|
public bool IsOnline { get; set; }
|
|
|
|
|
|
public bool IsLockedOut { get; set; }
|
2012-11-09 14:45:28 -01:00
|
|
|
|
public DateTime CreateDate { get; set; }
|
|
|
|
|
|
public DateTime UpdateDate { get; set; }
|
2012-11-05 14:42:21 -01:00
|
|
|
|
public DateTime LastLoginDate { get; set; }
|
|
|
|
|
|
public DateTime LastPasswordChangeDate { get; set; }
|
|
|
|
|
|
public DateTime LastLockoutDate { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public object ProfileId { get; set; }
|
|
|
|
|
|
public IEnumerable<object> Groups { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
2012-11-09 19:54:10 -01:00
|
|
|
|
|
|
|
|
|
|
#region Implementation of IUser
|
|
|
|
|
|
|
|
|
|
|
|
public string Lanuguage { get; set; }
|
|
|
|
|
|
public string Permissions { get; set; }
|
|
|
|
|
|
public bool DefaultToLiveEditing { get; set; }
|
|
|
|
|
|
public bool NoConsole { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public IUserType UserType
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
var type = Groups.FirstOrDefault();
|
|
|
|
|
|
return type as IUserType;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
2012-11-05 14:42:21 -01:00
|
|
|
|
}
|
|
|
|
|
|
}
|