Answered by:
Item level permissions

Question
-
Hi All,
I have 3 SharePoint Groups (Group A, B and C) all having contribute permission and a custom list “Activity”. I need Group A members to be able to add, edit and delete all items, but restrict Group B and C members to be able to edit and delete items created only by the user.
The “Create and Edit access:” property of the list is applicable to all the users irrespective of the groups.
I do I apply item level permissions in this situation?
Wednesday, August 29, 2012 9:19 AM
Answers
-
Hi All,
I managed to get this done using a list level worlflow and the impersonation step.The Workflow runs each time a new item is added and assign permissions specified in the impersonation step.
@Hiren - I havn't tried your code, but will try it out soon and update the post.
Many thanks,
Ameya
Friday, August 31, 2012 9:44 AM
All replies
-
Yes , you can do that things ,
First you need to break the permission and remove all the user/group except Group A,and this group is having a contribute rights on the list then grant the Group B and C to read only on the list.
Hiren Patel | Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you.
Wednesday, August 29, 2012 9:38 AM -
Hi Hiren,
I want to apply item level permission and not list level.Members of group B and C can also add,delete and edit entries,but only those created by users themselves , where as members of group A canmanage all the items no matter who has created it.
Wednesday, August 29, 2012 9:59 AM -
You can create a new Permission Level at the site collection level according to your need. And assign this new Permission level to your respective groups.Wednesday, August 29, 2012 10:10 AM
-
So for that you can write the ItemAdded event handler for the item level permission,
In one of my requirement i have done the thing like when new item is added from the custom form then i am setting the item level permission,
You need to do the same thing
take a reference of the code and implement ItemAdded event handler
public void InsertData() { SPWeb web = SPContext.Current.Web; web.AllowUnsafeUpdates = true; SPList listDetails = web.Lists.TryGetList("Details"); if (listDetails != null) { SPListItem item = listDetails.Items.Add(); item["FirstName"] = txtFirstName.Text; item["LastName"] = txtLastName.Text; if (ddlCountry.SelectedIndex != 0) item["Country"] = ddlCountry.SelectedItem.Text; if (ddlState.SelectedIndex != 0) item["State"] = ddlState.SelectedItem.Text; item.Update(); SPUser user = web.SiteUsers[ddlUsers.SelectedValue]; SPRoleAssignment roleassignment = new SPRoleAssignment(user); SPRoleDefinitionCollection webroledefinitions = web.RoleDefinitions; roleassignment.RoleDefinitionBindings.Add(webroledefinitions["Contribute"]); item.BreakRoleInheritance(false); item.RoleAssignments.Add(roleassignment); item.Update(); listDetails.Update(); } web.AllowUnsafeUpdates = false; }
Here first i break all the permission on the item then give contribute permission for the specific user selected from the drop down list.
Hiren Patel | Please click "Propose As Answer" if this post solves your problem or "Vote As Helpful" if this post has been useful to you.
- Edited by Hiren.j.Patel Wednesday, August 29, 2012 10:31 AM
- Proposed as answer by adnib123 Thursday, August 30, 2012 7:19 AM
Wednesday, August 29, 2012 10:29 AM -
1)Break the permission inheritence
2)Create two groups one with full control second with jus contribute
3)add A to full control, B and C to contribute
4)Go to list advance settings now change the settings to Create items and edit items that were created by the user under Item settings catogery
- Edited by Thilosh V N Wednesday, August 29, 2012 11:45 AM
Wednesday, August 29, 2012 11:44 AM -
Hi,
you can do this for this you have write your custom permission level.
- Proposed as answer by adnib123 Thursday, August 30, 2012 7:19 AM
Wednesday, August 29, 2012 11:48 AM -
Hi All,
I managed to get this done using a list level worlflow and the impersonation step.The Workflow runs each time a new item is added and assign permissions specified in the impersonation step.
@Hiren - I havn't tried your code, but will try it out soon and update the post.
Many thanks,
Ameya
Friday, August 31, 2012 9:44 AM