Fixes merge issues

This commit is contained in:
Shannon
2014-02-13 16:46:52 +11:00
parent c4acbf0dbc
commit d36cd035e9
19 changed files with 36 additions and 76 deletions

View File

@@ -36,7 +36,7 @@ namespace Umbraco.Core.Models.Membership
{
return MembershipScenario.NativeUmbraco;
}
var memberType = ApplicationContext.Current.Services.MemberTypeService.GetMemberType(Constants.Conventions.MemberTypes.Member);
var memberType = ApplicationContext.Current.Services.MemberTypeService.Get(Constants.Conventions.MemberTypes.Member);
return memberType != null
? MembershipScenario.CustomProviderWithUmbracoLink
: MembershipScenario.StandaloneCustomProvider;

View File

@@ -26,8 +26,7 @@ namespace Umbraco.Core.Persistence.Repositories
private readonly ITagsRepository _tagRepository;
private readonly CacheHelper _cacheHelper;
public ContentRepository(IDatabaseUnitOfWork work, IContentTypeRepository contentTypeRepository, ITemplateRepository templateRepository, ITagsRepository tagRepository)
public ContentRepository(IDatabaseUnitOfWork work, IContentTypeRepository contentTypeRepository, ITemplateRepository templateRepository, CacheHelper cacheHelper)
public ContentRepository(IDatabaseUnitOfWork work, IContentTypeRepository contentTypeRepository, ITemplateRepository templateRepository, ITagsRepository tagRepository, CacheHelper cacheHelper)
: base(work)
{
if (contentTypeRepository == null) throw new ArgumentNullException("contentTypeRepository");
@@ -41,8 +40,7 @@ namespace Umbraco.Core.Persistence.Repositories
EnsureUniqueNaming = true;
}
public ContentRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache, IContentTypeRepository contentTypeRepository, ITemplateRepository templateRepository, ITagsRepository tagRepository)
public ContentRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache, IContentTypeRepository contentTypeRepository, ITemplateRepository templateRepository, CacheHelper cacheHelper)
public ContentRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache, IContentTypeRepository contentTypeRepository, ITemplateRepository templateRepository, ITagsRepository tagRepository, CacheHelper cacheHelper)
: base(work, cache)
{
if (contentTypeRepository == null) throw new ArgumentNullException("contentTypeRepository");

View File

@@ -26,8 +26,7 @@ namespace Umbraco.Core.Persistence.Repositories
private readonly ITagsRepository _tagRepository;
private readonly IMemberGroupRepository _memberGroupRepository;
public MemberRepository(IDatabaseUnitOfWork work, IMemberTypeRepository memberTypeRepository, ITagsRepository tagRepository)
public MemberRepository(IDatabaseUnitOfWork work, IMemberTypeRepository memberTypeRepository, IMemberGroupRepository memberGroupRepository)
public MemberRepository(IDatabaseUnitOfWork work, IMemberTypeRepository memberTypeRepository, IMemberGroupRepository memberGroupRepository, ITagsRepository tagRepository)
: base(work)
{
if (memberTypeRepository == null) throw new ArgumentNullException("memberTypeRepository");
@@ -37,8 +36,7 @@ namespace Umbraco.Core.Persistence.Repositories
_memberGroupRepository = memberGroupRepository;
}
public MemberRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache, IMemberTypeRepository memberTypeRepository, ITagsRepository tagRepository)
public MemberRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache, IMemberTypeRepository memberTypeRepository, IMemberGroupRepository memberGroupRepository)
public MemberRepository(IDatabaseUnitOfWork work, IRepositoryCacheProvider cache, IMemberTypeRepository memberTypeRepository, IMemberGroupRepository memberGroupRepository, ITagsRepository tagRepository)
: base(work, cache)
{
if (memberTypeRepository == null) throw new ArgumentNullException("memberTypeRepository");

View File

@@ -60,12 +60,12 @@ namespace Umbraco.Core.Persistence
public virtual IContentRepository CreateContentRepository(IDatabaseUnitOfWork uow)
{
return new ContentRepository(
uow,
uow,
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : RuntimeCacheProvider.Current,
CreateContentTypeRepository(uow),
CreateTemplateRepository(uow),
CreateTagsRepository(uow)) { EnsureUniqueNaming = _settings.Content.EnsureUniqueNaming };
_cacheHelper) { EnsureUniqueNaming = Configuration.UmbracoSettings.EnsureUniqueNaming };
CreateTagsRepository(uow),
_cacheHelper) { EnsureUniqueNaming = _settings.Content.EnsureUniqueNaming };
}
public virtual IContentTypeRepository CreateContentTypeRepository(IDatabaseUnitOfWork uow)
@@ -176,15 +176,12 @@ namespace Umbraco.Core.Persistence
internal virtual IMemberRepository CreateMemberRepository(IDatabaseUnitOfWork uow)
{
return new MemberRepository(uow,
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : RuntimeCacheProvider.Current,
CreateMemberTypeRepository(uow),
CreateTagsRepository(uow));
return new MemberRepository(
uow,
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : RuntimeCacheProvider.Current,
uow,
_disableAllCache ? (IRepositoryCacheProvider)NullCacheProvider.Current : RuntimeCacheProvider.Current,
CreateMemberTypeRepository(uow),
CreateMemberGroupRepository(uow));
CreateMemberGroupRepository(uow),
CreateTagsRepository(uow));
}
internal virtual IMemberTypeRepository CreateMemberTypeRepository(IDatabaseUnitOfWork uow)

View File

@@ -58,7 +58,7 @@ namespace Umbraco.Core.Services
IPackagingService packagingService,
IEntityService entityService,
IRelationService relationService,
IMemberGroupService memberGroupService/*,
IMemberGroupService memberGroupService,
ISectionService sectionService,
IApplicationTreeService treeService,
ITagService tagService)

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence;
@@ -24,7 +25,7 @@ namespace Umbraco.Tests.Migrations.Upgrades
var templateRepository = new TemplateRepository(unitOfWork, NullCacheProvider.Current);
var tagRepository = new TagsRepository(unitOfWork, NullCacheProvider.Current);
contentTypeRepository = new ContentTypeRepository(unitOfWork, NullCacheProvider.Current, templateRepository);
var repository = new ContentRepository(unitOfWork, NullCacheProvider.Current, contentTypeRepository, templateRepository, tagRepository);
var repository = new ContentRepository(unitOfWork, NullCacheProvider.Current, contentTypeRepository, templateRepository, tagRepository, CacheHelper.CreateDisabledCacheHelper());
return repository;
}

View File

@@ -49,7 +49,7 @@ namespace Umbraco.Tests
new Mock<IDatabaseUnitOfWorkProvider>().Object,
new RepositoryFactory(true),
new Mock<IEntityService>().Object),
new Mock<IMemberGroupService>().Object/*,
new Mock<IMemberGroupService>().Object,
new Mock<ISectionService>().Object,
new Mock<IApplicationTreeService>().Object,
new Mock<ITagService>().Object);
@@ -90,11 +90,12 @@ namespace Umbraco.Tests
new Mock<IDatabaseUnitOfWorkProvider>().Object,
new RepositoryFactory(true),
new Mock<IEntityService>().Object),
new Mock<IMemberGroupService>().Object,
new Mock<ISectionService>().Object,
new Mock<IMemberGroupService>().Object),
new Mock<IApplicationTreeService>().Object,
new Mock<ITagService>().Object),
CacheHelper.CreateDisabledCacheHelper());
Assert.Pass();
}

View File

@@ -39,9 +39,8 @@ namespace Umbraco.Tests.Persistence.Repositories
{
var templateRepository = new TemplateRepository(unitOfWork, NullCacheProvider.Current);
var tagRepository = new TagsRepository(unitOfWork, NullCacheProvider.Current);
contentTypeRepository = new ContentTypeRepository(unitOfWork, NullCacheProvider.Current, templateRepository);
var repository = new ContentRepository(unitOfWork, NullCacheProvider.Current, contentTypeRepository, templateRepository, CacheHelper.CreateDisabledCacheHelper());
var repository = new ContentRepository(unitOfWork, NullCacheProvider.Current, contentTypeRepository, templateRepository, tagRepository);
contentTypeRepository = new ContentTypeRepository(unitOfWork, NullCacheProvider.Current, templateRepository);
var repository = new ContentRepository(unitOfWork, NullCacheProvider.Current, contentTypeRepository, templateRepository, tagRepository, CacheHelper.CreateDisabledCacheHelper());
return repository;
}

View File

@@ -37,8 +37,7 @@ namespace Umbraco.Tests.Persistence.Repositories
var templateRepository = new TemplateRepository(unitOfWork, NullCacheProvider.Current);
var tagRepository = new TagsRepository(unitOfWork, NullCacheProvider.Current);
contentTypeRepository = new ContentTypeRepository(unitOfWork, NullCacheProvider.Current, templateRepository);
var repository = new ContentRepository(unitOfWork, NullCacheProvider.Current, contentTypeRepository, templateRepository, tagRepository);
var repository = new ContentRepository(unitOfWork, NullCacheProvider.Current, contentTypeRepository, templateRepository, CacheHelper.CreateDisabledCacheHelper());
var repository = new ContentRepository(unitOfWork, NullCacheProvider.Current, contentTypeRepository, templateRepository, tagRepository, CacheHelper.CreateDisabledCacheHelper());
return repository;
}

View File

@@ -32,10 +32,9 @@ namespace Umbraco.Tests.Persistence.Repositories
private MemberRepository CreateRepository(IDatabaseUnitOfWork unitOfWork, out MemberTypeRepository memberTypeRepository, out MemberGroupRepository memberGroupRepository)
{
memberTypeRepository = new MemberTypeRepository(unitOfWork, NullCacheProvider.Current);
var tagRepo = new TagsRepository(unitOfWork, NullCacheProvider.Current);
var repository = new MemberRepository(unitOfWork, NullCacheProvider.Current, memberTypeRepository, tagRepo);
memberGroupRepository = new MemberGroupRepository(unitOfWork, NullCacheProvider.Current, CacheHelper.CreateDisabledCacheHelper());
var repository = new MemberRepository(unitOfWork, NullCacheProvider.Current, memberTypeRepository, memberGroupRepository);
var tagRepo = new TagsRepository(unitOfWork, NullCacheProvider.Current);
var repository = new MemberRepository(unitOfWork, NullCacheProvider.Current, memberTypeRepository, memberGroupRepository, tagRepo);
return repository;
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Linq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence;
@@ -694,7 +695,7 @@ namespace Umbraco.Tests.Persistence.Repositories
var templateRepository = new TemplateRepository(unitOfWork, NullCacheProvider.Current);
var tagRepository = new TagsRepository(unitOfWork, NullCacheProvider.Current);
contentTypeRepository = new ContentTypeRepository(unitOfWork, NullCacheProvider.Current, templateRepository);
var repository = new ContentRepository(unitOfWork, NullCacheProvider.Current, contentTypeRepository, templateRepository, tagRepository);
var repository = new ContentRepository(unitOfWork, NullCacheProvider.Current, contentTypeRepository, templateRepository, tagRepository, CacheHelper.CreateDisabledCacheHelper());
return repository;
}

View File

@@ -65,7 +65,7 @@ namespace Umbraco.Web.Editors
throw new NotSupportedException("Currently the user editor does not support providers that have RequiresQuestionAndAnswer specified");
}
var passwordChangeResult = Security.ChangePassword(Security.CurrentUser.Username, data, userProvider);
var passwordChangeResult = Members.ChangePassword(Security.CurrentUser.Username, data, userProvider);
if (passwordChangeResult.Success)
{
//even if we weren't resetting this, it is the correct value (null), otherwise if we were resetting then it will contain the new pword

View File

@@ -140,7 +140,7 @@ namespace Umbraco.Web.Editors
throw new HttpResponseException(HttpStatusCode.NotFound);
}
var contentType = Services.MemberTypeService.GetMemberType(contentTypeAlias);
var contentType = Services.MemberTypeService.Get(contentTypeAlias);
if (contentType == null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
@@ -384,7 +384,7 @@ namespace Umbraco.Web.Editors
return null;
}
var passwordChangeResult = Security.ChangePassword(membershipUser.UserName, contentItem.Password, Membership.Provider);
var passwordChangeResult = Members.ChangePassword(membershipUser.UserName, contentItem.Password, Membership.Provider);
if (passwordChangeResult.Success)
{
//If the provider has changed some values, these values need to be reflected in the member object

View File

@@ -41,7 +41,7 @@ namespace Umbraco.Web.Editors
/// </summary>
public IEnumerable<ContentTypeBasic> GetAllTypes()
{
return Services.MemberTypeService.GetAllMemberTypes()
return Services.MemberTypeService.GetAll()
.Select(Mapper.Map<IMemberType, ContentTypeBasic>);
}
}

View File

@@ -297,7 +297,7 @@ namespace Umbraco.Web.Models.Mapping
{
return MembershipScenario.NativeUmbraco;
}
var memberType = _memberTypeService.Value.GetMemberType(Constants.Conventions.MemberTypes.Member);
var memberType = _memberTypeService.Value.Get(Constants.Conventions.MemberTypes.Member);
return memberType != null
? MembershipScenario.CustomProviderWithUmbracoLink
: MembershipScenario.StandaloneCustomProvider;

View File

@@ -4,7 +4,6 @@ using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Umbraco.Core;
using umbraco.presentation.install.utills;
namespace Umbraco.Web.Mvc
{

View File

@@ -265,42 +265,9 @@ namespace Umbraco.Web.Security
{
return true;
}
return CurrentUser.Applications.Any(uApp => uApp.alias == app);
return CurrentUser.AllowedSections.Any(uApp => uApp.InvariantEquals(app));
}
internal void UpdateLogin(long timeout)
{
// only call update if more than 1/10 of the timeout has passed
if (timeout - (((TicksPrMinute * UmbracoTimeOutInMinutes) * 0.8)) < DateTime.Now.Ticks)
SqlHelper.ExecuteNonQuery(
"UPDATE umbracoUserLogins SET timeout = @timeout WHERE contextId = @contextId",
SqlHelper.CreateParameter("@timeout", DateTime.Now.Ticks + (TicksPrMinute * UmbracoTimeOutInMinutes)),
SqlHelper.CreateParameter("@contextId", UmbracoUserContextId));
}
internal long GetTimeout(string umbracoUserContextId)
{
return ApplicationContext.Current.ApplicationCache.GetCacheItem(
CacheKeys.UserContextTimeoutCacheKey + umbracoUserContextId,
new TimeSpan(0, UmbracoTimeOutInMinutes / 10, 0),
() => GetTimeout(true));
}
internal long GetTimeout(bool byPassCache)
{
if (UmbracoSettings.KeepUserLoggedIn)
RenewLoginTimeout();
if (byPassCache)
{
return SqlHelper.ExecuteScalar<long>("select timeout from umbracoUserLogins where contextId=@contextId",
SqlHelper.CreateParameter("@contextId", new Guid(UmbracoUserContextId))
);
}
return GetTimeout(UmbracoUserContextId);
}
/// <summary>
/// Gets the user id.
/// </summary>
@@ -412,7 +379,7 @@ namespace Umbraco.Web.Security
/// <returns></returns>
internal bool UserHasAppAccess(string app, IUser user)
{
var apps = _applicationContext.Services.UserService.GetUserSections(user);
var apps = user.AllowedSections;
return apps.Any(uApp => uApp.InvariantEquals(app));
}

View File

@@ -117,7 +117,7 @@ namespace Umbraco.Web.WebApi.Binders
{
if (Membership.Provider.Name == Constants.Conventions.Member.UmbracoMemberProviderName)
{
var contentType = ApplicationContext.Services.MemberTypeService.GetMemberType(model.ContentTypeAlias);
var contentType = ApplicationContext.Services.MemberTypeService.Get(model.ContentTypeAlias);
if (contentType == null)
{
throw new InvalidOperationException("No member type found wth alias " + model.ContentTypeAlias);
@@ -138,7 +138,7 @@ namespace Umbraco.Web.WebApi.Binders
//If the default Member type exists, we'll use that to create the IMember - that way we can associate the custom membership
// provider to our data - eventually we can support editing custom properties with a custom provider.
var memberType = ApplicationContext.Services.MemberTypeService.GetMemberType(Constants.Conventions.MemberTypes.Member);
var memberType = ApplicationContext.Services.MemberTypeService.Get(Constants.Conventions.MemberTypes.Member);
if (memberType != null)
{
FilterContentTypeProperties(memberType, memberType.PropertyTypes.Select(x => x.Alias).ToArray());

View File

@@ -606,6 +606,7 @@ namespace umbraco.BusinessLogic
// NH 4.7.1 changing default permission behavior to default to User Type permissions IF no specific permissions has been
// set for the current node
var nodeId = Path.Contains(",") ? int.Parse(Path.Substring(Path.LastIndexOf(",", StringComparison.Ordinal) + 1)) : int.Parse(Path);
if (cachedPermissions.Any(x => x.EntityId == nodeId))
{
var found = cachedPermissions.First(x => x.EntityId == nodeId);