Search code examples
sharepoint-2010bcs

Securing an external list by filtering for current user


I have set up an external content type with a column that contains Active Directory accounts to map each record to a user. Now I want users to only see those records in the list where the AD-account entry matches the current user's credentials.

So I tried the following approach, and succeeded in creating a user context filter on the ReadItem/create/update/delete operations. However, on the ReadList operation there is no option for it, the wizard has different filter options.

The result is that the current user can see all items in the external list, but can only open those tagged with his account, so the filter definitely works. However having the filter only on items and not on the whole list is useless (items that cannot be opened will confuse the user, a list view might expose the data anyway etc.).

I tried to filter this list with the Current User webpart, which gives us the desired result, but the list itself is of course still sitting in the background and can be opened via URL.

How can I get the user context filter applied on ReadList? And if that is not possible, where and how do you implement such a filter?


Solution

  • Export the BDC Metadata Model from SharePoint Designer and edit it by hand to include the UserContext filter. Then reimport the model through the BDC Service Application in Central Administration.