Showing posts with label User permissions. Show all posts
Showing posts with label User permissions. Show all posts

Wednesday, March 12, 2014

Check current logged-in user having permissions to specific group in SharePoint SPServices

We can check the groups for current logged-in user from SPServices code using “GetGroupCollectionFromUser” opration. Before the we have to download and add folowing files. Javascript 1.7.1.js and JQuery.SpServices-0.7.1a.min.js

Following script will used to get the user group details

$().SPServices({
operation: "GetGroupCollectionFromUser",
userLoginName: $().SPServices.SPGetCurrentUser(),
async: false,
completefunc: function (xData, Status) {
var count = 0;
$(xData.responseXML).find("Group").each(function () {
if ($(this).attr("Name") == "Group Name") 
count++; 
}
 }); 
if (count == 0) {
// do some action
}
else {
// do some action
}
}
});