SharePoint 2013 security trimming on pages

SharePoint 2013 security trimming on pages

Pages with webparts (XsltListViewWebPart), which are rendering libraries, are giving an error for users without access to the content they are rendering. Web Part Error: Access denied. You do not have permission to perform this action or access this resource. Correlation ID: c9d8129d-88f6-5035-3955-16a5262387ee

ErrorBrokenRights

Explanation:

Site with libraries, the libraries are with broken rights. A page is rendering those libraries with unique permissions. There are no audiences applied. In SharePoint 2010 (NTLM) the web parts were trimmed for the users without rights. In SharePoint 2013 (claims) there are showing an error.

HTML:

Error [1]

Web Part Error:
Access denied. You do not have permission to perform this action or access this resource.
Correlation ID: c364289d-d835-5035-0ea5-1e737d010f28.

First approach: create a CSS to hide the errors:

div[errorwebpart=”1″] { display:none !important; }
span[title~=”Error”]{ display:none !important; }

Second approach: create a JQuery script to hide the errors:

function hideError(){
var wikiInEditMode = document.forms[MSOWebPartPageFormName]._wikiPageMode.value;
if (wikiInEditMode != “Edit”){
$(“div[errorwebpart=’1′]”).hide();
$(“span:contains(‘Error’)”).hide();
}
}
_spBodyOnLoadFunctionNames.push(“hideError”);

Correct the apostrophes and the quotes in notepad or another editor!

Advertisements
This entry was posted in SharePoint 2013. Bookmark the permalink.