Web Service

Users and Groups




Check out the great example provided by Jim Bob Howard entitled Displaying/Hiding Content based on User Permissions or "When Edit permissions don't work...".

Here's the code from that write up:

<script src="" type="text/javascript"></script> 
<script src="/js/jquery.SPServices-0.5.1.min.js" type="text/javascript"></script> 
<script type="text/javascript">
$(document).ready(function() {

     operation: "GetRolesAndPermissionsForCurrentUser",
     async: false,
     completefunc: function(xData, Status) {
//        alert(xData.responseXML.xml);
        var userPerm = $(xData.responseXML).find("Permissions").attr("Value");
//        alert("userPerm = " + userPerm);
        var nonAdminP = (33554432 & userPerm) == 33554432;
//        alert("nonAdminP == 33554432: " + nonAdminP);
        var adminP = userPerm == 9223372036854775807;
//        alert(adminP);
        var hideEdit = !(nonAdminP | adminP);
//        alert("hideEdit = " + hideEdit);

        if (hideEdit) {
		   $("a[title='Edit Item']").parent().parent().parent().hide();

Last edited Dec 8, 2011 at 1:42 PM by sympmarc, version 3


juantrev May 28, 2013 at 5:06 PM 
This is working great for site level roles. Thanks.

However, does this not apply to list level roles? For example, if I have a site with numerous groups but a list on the same site that has the primary three groups (Visitors, Members and Owners), I know that the Members group has Contributer access and Owners have Full Control. Is there a way to hide the 'Edit Button' from Visitors on that specific list (not site level roles)? When I am running this on a list dispform I am getting the user permissions from the site not the list.

sympmarc Jan 6, 2012 at 2:29 AM 
glasses248: You only need to use SPFilterNode if you have a namespace with a colon in it (e.g., z:row) and you want to be sure to be cross-browser (non-IE) compatible. M.

glasses248 Jan 5, 2012 at 10:24 PM 
if you're using sp services 7.0, change this line:
var userPerm = $(xData.responseXML).find("Permissions").attr("Value");

var userPerm = $(xData.responseXML).SPFilterNode("Permissions").attr("Value");