Renaming User to Creator on Content - makes more sense.

This commit is contained in:
sitereactor
2012-11-05 14:43:51 -01:00
parent de9c373626
commit 5f6c4cdf92
9 changed files with 19 additions and 19 deletions

View File

@@ -21,7 +21,7 @@ namespace Umbraco.Core.Models
private int _sortOrder;
private int _level;
private string _path;
private IProfile _user;
private IProfile _creator;
private bool _trashed;
private int _contentTypeId;
private PropertyCollection _properties;
@@ -45,7 +45,7 @@ namespace Umbraco.Core.Models
private static readonly PropertyInfo SortOrderSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.SortOrder);
private static readonly PropertyInfo LevelSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.Level);
private static readonly PropertyInfo PathSelector = ExpressionHelper.GetPropertyInfo<ContentBase, string>(x => x.Path);
private static readonly PropertyInfo UserSelector = ExpressionHelper.GetPropertyInfo<ContentBase, IProfile>(x => x.User);
private static readonly PropertyInfo UserSelector = ExpressionHelper.GetPropertyInfo<ContentBase, IProfile>(x => x.Creator);
private static readonly PropertyInfo TrashedSelector = ExpressionHelper.GetPropertyInfo<ContentBase, bool>(x => x.Trashed);
private static readonly PropertyInfo DefaultContentTypeIdSelector = ExpressionHelper.GetPropertyInfo<ContentBase, int>(x => x.ContentTypeId);
private readonly static PropertyInfo PropertyCollectionSelector = ExpressionHelper.GetPropertyInfo<ContentBase, PropertyCollection>(x => x.Properties);
@@ -140,12 +140,12 @@ namespace Umbraco.Core.Models
/// IProfile of the user who created this Content
/// </summary>
[DataMember]
public virtual IProfile User
public virtual IProfile Creator
{
get { return _user; }
get { return _creator; }
set
{
_user = value;
_creator = value;
OnPropertyChanged(UserSelector);
}
}

View File

@@ -44,7 +44,7 @@ namespace Umbraco.Core.Models
/// <summary>
/// Profile of the user who created the Content
/// </summary>
IProfile User { get; set; }
IProfile Creator { get; set; }
/// <summary>
/// Boolean indicating whether this Content is Trashed or not.

View File

@@ -43,7 +43,7 @@ namespace Umbraco.Core.Persistence.Factories
: _id.ToGuid(),
Name = dto.ContentVersionDto.ContentDto.NodeDto.Text,
Path = dto.ContentVersionDto.ContentDto.NodeDto.Path,
User = _user,
Creator = _user,
Writer = _writer,
Level = dto.ContentVersionDto.ContentDto.NodeDto.Level,
ParentId = dto.ContentVersionDto.ContentDto.NodeDto.ParentId,
@@ -127,7 +127,7 @@ namespace Umbraco.Core.Persistence.Factories
Text = entity.Name,
Trashed = entity.Trashed,
UniqueId = entity.Key,
UserId = entity.User.Id.SafeCast<int>()
UserId = entity.Creator.Id.SafeCast<int>()
};
return nodeDto;

View File

@@ -41,7 +41,7 @@ namespace Umbraco.Core.Persistence.Factories
: _id.ToGuid(),
Name = dto.ContentDto.NodeDto.Text,
Path = dto.ContentDto.NodeDto.Path,
User = _user,
Creator = _user,
Level = dto.ContentDto.NodeDto.Level,
ParentId = dto.ContentDto.NodeDto.ParentId,
SortOrder = dto.ContentDto.NodeDto.SortOrder,
@@ -102,7 +102,7 @@ namespace Umbraco.Core.Persistence.Factories
Text = entity.Name,
Trashed = entity.Trashed,
UniqueId = entity.Key,
UserId = entity.User.Id.SafeCast<int>()
UserId = entity.Creator.Id.SafeCast<int>()
};
return nodeDto;

View File

@@ -36,7 +36,7 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<Content, NodeDto>(src => src.Name, dto => dto.Text);
CacheMap<Content, NodeDto>(src => src.Trashed, dto => dto.Trashed);
CacheMap<Content, NodeDto>(src => src.Key, dto => dto.UniqueId);
CacheMap<Content, NodeDto>(src => src.User, dto => dto.UserId);
CacheMap<Content, NodeDto>(src => src.Creator, dto => dto.UserId);
CacheMap<Content, ContentDto>(src => src.ContentTypeId, dto => dto.ContentTypeId);
CacheMap<Content, ContentVersionDto>(src => src.UpdateDate, dto => dto.VersionDate);
CacheMap<Content, ContentVersionDto>(src => src.Version, dto => dto.VersionId);

View File

@@ -35,7 +35,7 @@ namespace Umbraco.Core.Persistence.Mappers
CacheMap<Models.Media, NodeDto>(src => src.Name, dto => dto.Text);
CacheMap<Models.Media, NodeDto>(src => src.Trashed, dto => dto.Trashed);
CacheMap<Models.Media, NodeDto>(src => src.Key, dto => dto.UniqueId);
CacheMap<Models.Media, NodeDto>(src => src.User, dto => dto.UserId);
CacheMap<Models.Media, NodeDto>(src => src.Creator, dto => dto.UserId);
CacheMap<Models.Media, ContentDto>(src => src.ContentTypeId, dto => dto.ContentTypeId);
CacheMap<Models.Media, ContentVersionDto>(src => src.UpdateDate, dto => dto.VersionDate);
CacheMap<Models.Media, ContentVersionDto>(src => src.Version, dto => dto.VersionId);

View File

@@ -174,7 +174,7 @@ namespace Umbraco.Tests.Persistence.Repositories
var contentType = contentTypeRepository.Get(1045);
var content = new Content(1048, contentType);
content.Name = "Textpage 2 Child Node";
content.User = new Profile(0, "Administrator");
content.Creator = new Profile(0, "Administrator");
// Act
repository.AddOrUpdate(content);

View File

@@ -7,7 +7,7 @@ namespace Umbraco.Tests.TestHelpers.Entities
{
public static Content CreateSimpleContent(IContentType contentType)
{
var content = new Content(-1, contentType) { Name = "Home", Language = "en-US", Level = 1, ParentId = -1, SortOrder = 1, Template = "~/masterpages/umbTextPage.master", User = new Profile(0, "Administrator"), Writer = new Profile(0, "Administrator") };
var content = new Content(-1, contentType) { Name = "Home", Language = "en-US", Level = 1, ParentId = -1, SortOrder = 1, Template = "~/masterpages/umbTextPage.master", Creator = new Profile(0, "Administrator"), Writer = new Profile(0, "Administrator") };
object obj =
new
{
@@ -23,7 +23,7 @@ namespace Umbraco.Tests.TestHelpers.Entities
public static Content CreateSimpleContent(IContentType contentType, string name, int parentId)
{
var content = new Content(parentId, contentType) { Name = name, Language = "en-US", ParentId = parentId, Template = "~/masterpages/umbTextPage.master", User = new Profile(0, "Administrator"), Writer = new Profile(0, "Administrator") };
var content = new Content(parentId, contentType) { Name = name, Language = "en-US", ParentId = parentId, Template = "~/masterpages/umbTextPage.master", Creator = new Profile(0, "Administrator"), Writer = new Profile(0, "Administrator") };
object obj =
new
{
@@ -39,7 +39,7 @@ namespace Umbraco.Tests.TestHelpers.Entities
public static Content CreateTextpageContent(IContentType contentType, string name, int parentId)
{
var content = new Content(parentId, contentType) { Name = name, Language = "en-US", ParentId = parentId, Template = "~/masterpages/umbTextPage.master", User = new Profile(0, "Administrator"), Writer = new Profile(0, "Administrator")};
var content = new Content(parentId, contentType) { Name = name, Language = "en-US", ParentId = parentId, Template = "~/masterpages/umbTextPage.master", Creator = new Profile(0, "Administrator"), Writer = new Profile(0, "Administrator")};
object obj =
new
{

View File

@@ -644,18 +644,18 @@ namespace Umbraco.Web.Services
if(userId > -1)
{
//If a user id was passed in we use that
content.User = new Profile(userId, "");
content.Creator = new Profile(userId, "");
}
else if(_userService != null)
{
//If the UserService has been set for this instance of the ServiceContext
//we retrieve the current users id from there.
content.User = _userService.GetCurrentBackOfficeUser();
content.Creator = _userService.GetCurrentBackOfficeUser();
}
else
{
//Otherwise we default to Admin user, which should always exist (almost always)
content.User = new Profile(0, "Administrator");
content.Creator = new Profile(0, "Administrator");
}
}