publicizes user stuff, changes the IUser.Id to an int - no need for it to be an object and casted everywhere. Updates the login logic to perform the mapping logic for custom membership providers with an extension method.

This commit is contained in:
Shannon
2014-01-22 14:07:18 +11:00
parent fb9569d914
commit 9bd8d729fa
8 changed files with 109 additions and 50 deletions

View File

@@ -3,6 +3,10 @@
/// <summary>
/// Defines the the Profile interface
/// </summary>
/// <remarks>
/// This interface is pretty useless but has been exposed publicly from 6.x so we're stuck with it. It would make more sense
/// if the Id was an int but since it's not people have to cast it to int all of the time!
/// </remarks>
public interface IProfile
{
object Id { get; set; }

View File

@@ -9,7 +9,7 @@ namespace Umbraco.Core.Models.Membership
/// <remarks>Will be left internal until a proper Membership implementation is part of the roadmap</remarks>
public interface IUser : IMembershipUser, IProfile
{
new object Id { get; set; }
new int Id { get; set; }
int SessionTimeout { get; set; }
int StartContentId { get; set; }

View File

@@ -19,7 +19,7 @@ namespace Umbraco.Core.Models.Membership
/// </remarks>
[Serializable]
[DataContract(IsReference = true)]
internal class User : TracksChangesEntityBase, IUser
public class User : TracksChangesEntityBase, IUser
{
public User(IUserType userType)
{
@@ -45,7 +45,7 @@ namespace Umbraco.Core.Models.Membership
private readonly IUserType _userType;
private bool _hasIdentity;
private object _id;
private int _id;
private string _name;
private Type _userTypeKey;
private readonly List<string> _addedSections;
@@ -242,6 +242,12 @@ namespace Umbraco.Core.Models.Membership
#region Implementation of IProfile
object IProfile.Id
{
get { return Id; }
set { Id = (int)value; }
}
[DataMember]
public string Name
{
@@ -355,7 +361,7 @@ namespace Umbraco.Core.Models.Membership
}
[DataMember]
public object Id
public int Id
{
get { return _id; }
set