I need to implement list item level permission based on rules something like this:
Users can access a given list item only when they satisfy the criteria/rule of this given list item. [such as users' business group(BG) is present in the item's fields]
List Item: MyDocument1
List Fields: AllowedBG= [BG1, BG2] (this is multiple choices data type)
User A: BG=BG1
User B: BG=BG3
Here UserA can access MyDocument1 because his BG is within MyDocument1.AllowedBG,
UserB cannot access because his BG is not present in the MyDocument1.AllowedBG
Note that this is only a simplified version of my domain problem. In reality we have 3 fields in the list item to check permission for each user, so it is not possible to use User Group to manage permissions.
I can think of a workaround: (not verified)
- Create a customized view and edit aspx page for this list with Visual Studio
- In the Page_Load method (or some other methods) check user's permission (need to RunWithElevatedPrivileges)
- If check is successful, redirect to the original view/edit form.
- If check is failed, send NotAuthorizedException to users
So what is the ideal/better way of implementing such rule based item level permission in SharePoint?