Exemplo n.º 1
0
        public override IQueryable <TEntity> AsQueryable <TEntity>()
        {
            var Maps = _mappingsCache.GetRelationships <TEntity>();
            IQueryable <TEntity> query = base.AsQueryable <TEntity>();

            foreach (var Relationship in Maps)
            {
                var singleType = Relationship.SecuredBy.ToSingleType();
                if (!EntitlementProvider.IsEntitledToAll(singleType))
                {
                    var entitledIds = EntitlementProvider.GetEntitledIds(singleType);
                    if (entitledIds != null && entitledIds.Any())
                    {
                        query = Relationship.ApplySecurity(query, entitledIds);
                    }
                }
            }
            return(query);
        }