I have a Discussion list. I have 3 classes of users:
Owners Contributors Viewers
The list is configured to allow Contributors Add/Edit/Delete permissions, however in the Advanced Settings for the list, the Item Level permissions are set to "Only their own" (that is users can Edit/Delete only their own Discussions/Replies).
I see that in this scenario the OOB SharePoint UI doesn't security trim the Discussions/Replies when displayed in OOB SharePoint list views and view/edit forms. However, when I attempt to take the save the Edit/Delete action in the OOB SharePoint UI, I get redirected to the Access Denied page.
I have attempted to build custom UI on top of the Discussion list (think custom web parts/usercontrols/etc.). I have code to check to see if a user can edit the item by using code similar to the following:
lbtnDelete.Visible = listItem.DoesUserHavePermissions(SPBasePermissions.DeleteListItems);
This doesn't appear to be checking the permissions at the level of detail needed to determine if the user should be able to actually edit the item or not (i.e. by checking the SPList's WriteSecurity (1 = Any item, 2 = Only their own, 4 = None).
What is the proper way to confirm a user actually has Edit/Delete permissions, taking into account the Item Level Permissions?