I have a simple security model where there is:
and many of the many links between these tables, so the user must perform roles and roles along the way. I'm trying to write a function, so that from the username and path it will return a bool value based on whether the user has access to this path. How can I do this with entity infrastructure? I currently have:
var rolesForUser = _entities.Users
.Include("Roles")
.Where(u => u.Login.Equals(username))
.Select(u => u.Roles);
if(rolesForUser.Count() == 0) return false;
var authentications = _entities.WebPaths
.Where(p => p.Path == path)
.WhereIn(p => p.Roles, rolesForUser);
return (authentications.Count() > 0);
which uses the WhereIn extension method , however this can only be compared to primitives, so this is not working at the moment. Any suggestions are welcome.
source
share