I'm using ado.net data services and want to implement row level security in the query interceptor to limit the data to only return data that the user is allowed to see. The complexity comes in in that the user name for the the user is on another table. So I thought I could retrieve a list of events that the user can see according to the entry in the OnlineSubscription table for that user and then return whether the current event matches any entries that are returned as follows:
[QueryInterceptor("Events")]
public Expression<Func<Events, bool>> QueryEvents()
{
var allowedEventList = (from os in context.OnlineSubscription
from e in os.Events
where os.UserName == HttpContext.Current.User.Identity.Name
select e;
return e => events.Intersect(new List<Events>
{
e
}).Any();
}
However this throws a "Not implemented" exception. So my question is: Is there a right way to compare the current entity to a list of entities in the query interceptor?
EDIT: I've also tried:
return e => events.Any(evnt => evnt.Event_Key == e.Event_Key);
without any success (once again getting the "Not implemented" exception).