jQuery & SharePoint Groups

Dec 5, 2011 at 3:27 PM

Can SPServices be used to perform if-then functionality using SharePoint UserGroups?  e.g.  users belonging to an "Administration" group can 'see this....'  users belonging to a "Visitors" group can 'see that....'

Permission masks are fine, but it's more typical (IMO) to have cases where you're controlling action and functionaliy based on a SP group.  I'm looking to see if there's a solution out there without using managed code/solutions that can actually do this.



Dec 5, 2011 at 3:38 PM

Ok.. I've stumbled upon this blog (Thanks Marc!).   Seems to indicate that it's possible.


I'd be very interested to see other resources/posts/discussions if anyone can direct me towards them.


Thanks again!

Dec 8, 2011 at 1:09 PM


You can certainly do permission checking client side. Just understand that anything you do in script is not securing, but only obscuring content.


Dec 9, 2011 at 6:01 PM


Here is the code I have implemented in one of my applications for doing this type of thing client side... it checks only to see if the user considered a Visitor, Contributor or a Full Control... Other types can be used by trying to match up the permission mask (info. on permissions masks here)...The example below stores the current user's permission "group" in global variable and then I use that variable to show/hide/do/suppress functionality from certain groups.

    operation: "GetRolesAndPermissionsForCurrentUser",
    async: false,
    completefunc: function(xData, Status) {
//      userFullPerm = "9223372036854775807";	// Full Control
//	userFullPerm = "1856436900591";			// Contribute
//	userFullPerm = "756052856929";			// Read only
        var userFullPerm = $(xData.responseXML).find("[nodeName='Permissions']").attr("Value");
        // Paul:
        //  the code from this point foward, does actions on the
        //  page based on what the permissions level of the user.
        //  You should change to fit your needs
        // Hide ADMIN choices if not in admin group
        if (userFullPerm != 9223372036854775807) {
        // If full permission, then set class on page and exit now
        } else {
            $(".tt-library-perm-fullControl").css("display", "");
            $.tt.params.userPerm.hasFullControl	= true;
            $.tt.params.userPerm.hasContribute	= true;
        // Hide if user has no editListItems permissions (no contribute)
        if ((4 & userFullPerm) != 4) {
        } else {
            $(".tt-library-hasContribute").css("display", "");
            $.tt.params.userPerm.hasContribute = true;

As mark indicated, note that this is security through obscurity...