views:

197

answers:

1

In a list where items only can be changed by owner or admin how can I check by code if a user can edit the item.

I try

item.DoesUserHavePermissions(SPBasePermissions.EditListItems);

it will return True as the user can add and edit items in list.

+1  A: 

Checking the user against author field may be the only way to go.

Alternatively you can limit the list of items the user can try to edit by making a query that only brings back items they are the author of unless they have broader rights.

Check for broader rights using the SPRoleDefinition and SPRoleAssignment classes.

Other wise just try the edit and catch the exception and raise it back to the user.

Nat

related questions