Adding some initial work for Membership related classes and interfaces, but only using IProfile and Profile as the rest are not part of the roadmap.

Adding a UserService, which should be fully implemented in a later release.
Refactoring usage of the ServiceContext, which is now loosely tied to the HttpContext as its used by the UserService.
Refactoring User/Writer on the Content class and interface.
Simplifying events and delegates in the publishing strategy.
This commit is contained in:
sitereactor
2012-11-05 14:42:21 -01:00
parent fe6bbdf005
commit de9c373626
34 changed files with 601 additions and 177 deletions

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
namespace Umbraco.Core.Models.Membership
{
internal interface IMembershipUser : IMembershipUserId
{
object Id { get; set; }
string Username { get; set; }
string Email { get; set; }
string Password { get; set; }
string PasswordQuestion { get; set; }
string PasswordAnswer { get; set; }
string Comments { get; set; }
bool IsApproved { get; set; }
bool IsOnline { get; set; }
bool IsLockedOut { get; set; }
DateTime CreationDate { get; set; }
DateTime LastLoginDate { get; set; }
DateTime LastActivityDate { get; set; }
DateTime LastPasswordChangeDate { get; set; }
DateTime LastLockoutDate { get; set; }
object ProfileId { get; set; }
IEnumerable<object> Groups { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace Umbraco.Core.Models.Membership
{
internal interface IMembershipUserId
{
object ProviderUserKey { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace Umbraco.Core.Models.Membership
{
/// <summary>
/// Defines the the Profile interface
/// </summary>
public interface IProfile
{
object Id { get; set; }
string Name { get; set; }
}
}

View File

@@ -0,0 +1,52 @@
using System;
namespace Umbraco.Core.Models.Membership
{
/// <summary>
/// Represents a Profile which is shared between Members and Users
/// </summary>
public class Profile : IProfile
{
/// <summary>
/// Initializes a new instance of the <see cref="Profile"/> class.
/// </summary>
public Profile()
{
ProviderUserKeyType = typeof(int);
}
public Profile(object id, string name)
{
ProviderUserKeyType = typeof(int);
Id = id;
Name = name;
}
public object Id { get; set; }
public string Name { get; set; }
internal virtual object ProviderUserKey
{
get { throw new System.NotImplementedException(); }
set { throw new System.NotImplementedException(); }
}
/// <summary>
/// Gets or sets the type of the provider user key.
/// </summary>
/// <value>
/// The type of the provider user key.
/// </value>
internal Type ProviderUserKeyType { get; private set; }
/// <summary>
/// Sets the type of the provider user key.
/// </summary>
/// <param name="type">The type.</param>
internal void SetProviderUserKeyType(Type type)
{
ProviderUserKeyType = type;
}
}
}

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
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>
internal class User : UserProfile, IMembershipUser
{
#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; }
public DateTime CreationDate { get; set; }
public DateTime LastLoginDate { get; set; }
public DateTime LastActivityDate { get; set; }
public DateTime LastPasswordChangeDate { get; set; }
public DateTime LastLockoutDate { get; set; }
public object ProfileId { get; set; }
public IEnumerable<object> Groups { get; set; }
#endregion
#region Implementation of IMembershipUserId
public new object ProviderUserKey { get; set; }
#endregion
}
}

View File

@@ -0,0 +1,53 @@
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Core.Models.Membership
{
/// <summary>
/// Represents the Profile implementation for a backoffice User
/// </summary>
/// <remarks>
/// Should be internal until a proper user/membership implementation
/// is part of the roadmap.
/// </remarks>
internal class UserProfile : Profile
{
public UserProfile()
{
SessionTimeout = 60;
Applications = Enumerable.Empty<string>();
}
/// <summary>
/// Gets or sets the session timeout.
/// </summary>
/// <value>
/// The session timeout.
/// </value>
public int SessionTimeout { get; set; }
/// <summary>
/// Gets or sets the start content id.
/// </summary>
/// <value>
/// The start content id.
/// </value>
public int StartContentId { get; set; }
/// <summary>
/// Gets or sets the start media id.
/// </summary>
/// <value>
/// The start media id.
/// </value>
public int StartMediaId { get; set; }
/// <summary>
/// Gets or sets the applications.
/// </summary>
/// <value>
/// The applications.
/// </value>
public IEnumerable<string> Applications { get; set; }
}
}