From f48166e6ed99478ab9e975d95c9db40cbacf8913 Mon Sep 17 00:00:00 2001
From: Claus
Date: Wed, 21 Oct 2015 11:29:05 +0200
Subject: [PATCH] Fixes: U4-6962 Public access in multiple levels is broken in
7.3
Ensured the backoffice UI will look at protection for the specific node only (no inheritance) when specifying public access.
Added non-recursive method to Access class.
Fixed bug causing the tree (child nodes) not to update correctly after changing public access on nodes.
---
.../umbraco/dialogs/protectPage.aspx.cs | 11 +++++++----
src/umbraco.cms/businesslogic/web/Access.cs | 8 +++++++-
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs
index 3cf3e7ad64..40e2532107 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs
@@ -79,7 +79,7 @@ namespace umbraco.presentation.umbraco.dialogs
if (IsPostBack == false)
{
- if (Access.IsProtected(documentId, documentObject.Path) && Access.GetProtectionType(documentId) != ProtectionType.NotProtected)
+ if (Access.IsProtected(documentId) && Access.GetProtectionType(documentId) != ProtectionType.NotProtected)
{
bt_buttonRemoveProtection.Visible = true;
bt_buttonRemoveProtection.Attributes.Add("onClick", "return confirm('" + ui.Text("areyousure") + "')");
@@ -263,10 +263,11 @@ namespace umbraco.presentation.umbraco.dialogs
p_buttons.Visible = false;
pane_advanced.Visible = false;
pane_simple.Visible = false;
-
var content = ApplicationContext.Current.Services.ContentService.GetById(pageId);
+ //reloads the current node in the tree
ClientTools.SyncTree(content.Path, true);
-
+ //reloads the current node's children in the tree
+ ClientTools.ReloadActionNode(false, true);
feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success;
}
}
@@ -284,8 +285,10 @@ namespace umbraco.presentation.umbraco.dialogs
feedback.Text = ui.Text("publicAccess", "paIsRemoved", new cms.businesslogic.CMSNode(pageId).Text) + "
" + ui.Text("closeThisWindow") + "";
var content = ApplicationContext.Current.Services.ContentService.GetById(pageId);
+ //reloads the current node in the tree
ClientTools.SyncTree(content.Path, true);
-
+ //reloads the current node's children in the tree
+ ClientTools.ReloadActionNode(false, true);
feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success;
}
diff --git a/src/umbraco.cms/businesslogic/web/Access.cs b/src/umbraco.cms/businesslogic/web/Access.cs
index bcbbbb9c69..3d4470d23c 100644
--- a/src/umbraco.cms/businesslogic/web/Access.cs
+++ b/src/umbraco.cms/businesslogic/web/Access.cs
@@ -213,7 +213,7 @@ namespace umbraco.cms.businesslogic.web
var noAccessContent = ApplicationContext.Current.Services.ContentService.GetById(ErrorDocumentId);
if (noAccessContent == null) throw new NullReferenceException("No content item found with id " + ErrorDocumentId);
- var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(doc.ContentEntity);
+ var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(doc.ContentEntity.Id.ToString());
if (entry != null)
{
if (Simple)
@@ -420,6 +420,12 @@ namespace umbraco.cms.businesslogic.web
return ApplicationContext.Current.Services.PublicAccessService.IsProtected(Path.EnsureEndsWith("," + DocumentId));
}
+ //return the protection status of this exact document - not based on inheritance
+ public static bool IsProtected(int DocumentId)
+ {
+ return ApplicationContext.Current.Services.PublicAccessService.IsProtected(DocumentId.ToString());
+ }
+
public static int GetErrorPage(string Path)
{
var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(Path);