Showing posts with label sharepoint item level security. Show all posts
Showing posts with label sharepoint item level security. Show all posts

Sharepoint 2007 Field Level Permissions(Sharepoint Group) using JQuery

I have developed a way on how to hide, disable, and change fields or their attributes based on which SharePoint group the user belongs to. I have done this using nothing but JQuery code. The code can be placed into a content editor web part on your page or injected straight into your aspx page!

The following are the steps to achieve field level permissions:

1. Write a function called, for example, DisableHideField in JQuery to disable and or hide form fields based on id, type, tag name, value, and title. I recommend passing in these parameters to the function your create.

2. Find these by going to "view source" on the page you want to modify

3. Create a function that utilizes JQuery library which contains methods to access SharePoint web services

3. Inside the SharePoint web service utilizing function, access the GetGroupCollectionFromUser SharePoint web service. This web service contains all the groups that the current user belongs to.

4. Then inside the same function, parse the response from the web service and find your desired SharePoint group.

5. If the SharePoint user group is found, then call your DisableHideField function inside your if statement

6. Then repeat step 5 logic for different SharePoint groups

7. VOILA..............FIELD LEVEL PERMISSIONS!!!

Hope you enjoyed this post and please feel free to ask any questions in the comments.

Have a great day!