diff --git a/src/Umbraco.Core/Models/IContent.cs b/src/Umbraco.Core/Models/IContent.cs
index 3121326f60..38110b00bb 100644
--- a/src/Umbraco.Core/Models/IContent.cs
+++ b/src/Umbraco.Core/Models/IContent.cs
@@ -20,12 +20,7 @@ namespace Umbraco.Core.Models
///
bool Published { get; }
- ///
- /// Language of the data contained within this Content object.
- ///
- ///
- /// Left internal until multilingual support is implemented.
- ///
+ [Obsolete("This will be removed in future versions")]
string Language { get; set; }
///
diff --git a/src/Umbraco.Core/Services/PublicAccessServiceExtensions.cs b/src/Umbraco.Core/Services/PublicAccessServiceExtensions.cs
index 3bb2e87370..0b682b2b6e 100644
--- a/src/Umbraco.Core/Services/PublicAccessServiceExtensions.cs
+++ b/src/Umbraco.Core/Services/PublicAccessServiceExtensions.cs
@@ -11,7 +11,37 @@ namespace Umbraco.Core.Services
public static class PublicAccessServiceExtensions
{
- internal static bool HasAccess(this IPublicAccessService publicAccessService, int documentId, IContentService contentService, IEnumerable currentMemberRoles)
+ public static bool RenameMemberGroupRoleRules(this IPublicAccessService publicAccessService, string oldRolename, string newRolename)
+ {
+ var hasChange = false;
+ if (oldRolename == newRolename) return false;
+
+ var allEntries = publicAccessService.GetAll();
+
+ foreach (var entry in allEntries)
+ {
+ //get rules that match
+ var roleRules = entry.Rules
+ .Where(x => x.RuleType == Constants.Conventions.PublicAccess.MemberRoleRuleType)
+ .Where(x => x.RuleValue == oldRolename);
+ var save = false;
+ foreach (var roleRule in roleRules)
+ {
+ //a rule is being updated so flag this entry to be saved
+ roleRule.RuleValue = newRolename;
+ save = true;
+ }
+ if (save)
+ {
+ hasChange = true;
+ publicAccessService.Save(entry);
+ }
+ }
+
+ return hasChange;
+ }
+
+ public static bool HasAccess(this IPublicAccessService publicAccessService, int documentId, IContentService contentService, IEnumerable currentMemberRoles)
{
var content = contentService.GetById(documentId);
if (content == null) return true;
diff --git a/src/Umbraco.Web/Strategies/PublicAccessEventHandler.cs b/src/Umbraco.Web/Strategies/PublicAccessEventHandler.cs
index 86b3066413..d543567ac3 100644
--- a/src/Umbraco.Web/Strategies/PublicAccessEventHandler.cs
+++ b/src/Umbraco.Web/Strategies/PublicAccessEventHandler.cs
@@ -10,7 +10,7 @@ using Umbraco.Core.Services;
namespace Umbraco.Web.Strategies
{
///
- /// Used to ensure that the access.xml file is kept up to date properly
+ /// Used to ensure that the public access data file is kept up to date properly
///
public sealed class PublicAccessEventHandler : ApplicationEventHandler
{
@@ -31,7 +31,7 @@ namespace Umbraco.Web.Strategies
&& grp.AdditionalData["previousName"].ToString().IsNullOrWhiteSpace() == false
&& grp.AdditionalData["previousName"].ToString() != grp.Name)
{
- Access.RenameMemberShipRole(grp.AdditionalData["previousName"].ToString(), grp.Name);
+ ApplicationContext.Current.Services.PublicAccessService.RenameMemberGroupRoleRules(grp.AdditionalData["previousName"].ToString(), grp.Name);
}
}
}
diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs
index 9ed37b29d6..50267f1d05 100644
--- a/src/Umbraco.Web/Trees/ContentTreeController.cs
+++ b/src/Umbraco.Web/Trees/ContentTreeController.cs
@@ -106,7 +106,7 @@ namespace Umbraco.Web.Trees
if (entity.HasPendingChanges)
node.SetHasUnpublishedVersionStyle();
- if (Access.IsProtected(e.Id, e.Path))
+ if (Services.PublicAccessService.IsProtected(e.Path))
node.SetProtectedStyle();
return node;
diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs
index a394007048..c9731d20ad 100644
--- a/src/Umbraco.Web/UmbracoHelper.cs
+++ b/src/Umbraco.Web/UmbracoHelper.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections;
+using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
@@ -14,6 +15,7 @@ using Umbraco.Core.Dictionary;
using Umbraco.Core.Dynamics;
using Umbraco.Core.Models;
using Umbraco.Core.Security;
+using Umbraco.Core.Services;
using Umbraco.Core.Xml;
using Umbraco.Web.Routing;
using Umbraco.Web.Security;
@@ -23,6 +25,7 @@ using System.Collections.Generic;
using umbraco.cms.businesslogic.web;
using umbraco.presentation.templateControls;
using Umbraco.Core.Cache;
+using AttributeCollection = System.Web.UI.AttributeCollection;
namespace Umbraco.Web
{
@@ -484,32 +487,44 @@ namespace Umbraco.Web
#region Membership
- ///
- /// Check if a document object is protected by the "Protect Pages" functionality in umbraco
- ///
- /// The identifier of the document object to check
- /// The full path of the document object to check
- /// True if the document object is protected
- public bool IsProtected(int documentId, string path)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("Use the IsProtected method that only specifies path")]
+ public bool IsProtected(int documentId, string path)
{
- return Access.IsProtected(documentId, path);
+ return IsProtected(path.EnsureEndsWith("," + documentId));
}
- ///
- /// Check if the current user has access to a document
- ///
- /// The identifier of the document object to check
- /// The full path of the document object to check
- /// True if the current user has access or if the current document isn't protected
- public bool MemberHasAccess(int nodeId, string path)
- {
- if (IsProtected(nodeId, path))
- {
+ ///
+ /// Check if a document object is protected by the "Protect Pages" functionality in umbraco
+ ///
+ /// The full path of the document object to check
+ /// True if the document object is protected
+ public bool IsProtected(string path)
+ {
+ return UmbracoContext.Application.Services.PublicAccessService.IsProtected(path);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ [Obsolete("Use the MemberHasAccess method that only specifies path")]
+ public bool MemberHasAccess(int nodeId, string path)
+ {
+ return MemberHasAccess(path.EnsureEndsWith("," + nodeId));
+ }
+
+ ///
+ /// Check if the current user has access to a document
+ ///
+ /// The full path of the document object to check
+ /// True if the current user has access or if the current document isn't protected
+ public bool MemberHasAccess(string path)
+ {
+ if (IsProtected(path))
+ {
return _membershipHelper.IsLoggedIn()
- && Access.HasAccess(nodeId, path, GetCurrentMember());
- }
- return true;
- }
+ && UmbracoContext.Application.Services.PublicAccessService.HasAccess(path, GetCurrentMember(), Roles.Provider);
+ }
+ return true;
+ }
///
/// Gets (or adds) the current member from the current request cache
diff --git a/src/umbraco.cms/businesslogic/web/Access.cs b/src/umbraco.cms/businesslogic/web/Access.cs
index e7e61dd35a..8271fa581f 100644
--- a/src/umbraco.cms/businesslogic/web/Access.cs
+++ b/src/umbraco.cms/businesslogic/web/Access.cs
@@ -180,30 +180,8 @@ namespace umbraco.cms.businesslogic.web
public static bool RenameMemberShipRole(string oldRolename, string newRolename)
{
- var hasChange = false;
- if (oldRolename == newRolename) return false;
-
- var allEntries = ApplicationContext.Current.Services.PublicAccessService.GetAll();
-
- foreach (var entry in allEntries)
- {
- //get rules that match
- var roleRules = entry.Rules
- .Where(x => x.RuleType == Constants.Conventions.PublicAccess.MemberRoleRuleType)
- .Where(x => x.RuleValue == oldRolename);
- var save = false;
- foreach (var roleRule in roleRules)
- {
- //a rule is being updated so flag this entry to be saved
- roleRule.RuleValue = newRolename;
- save = true;
- }
- if (save)
- {
- hasChange = true;
- ApplicationContext.Current.Services.PublicAccessService.Save(entry);
- }
- }
+ var hasChange = ApplicationContext.Current.Services.PublicAccessService.RenameMemberGroupRoleRules(oldRolename, newRolename);
+
if (hasChange)
Save();