public IEnumerable <TEntity> Filter(IEnumerable <TEntity> entities) { DataPrivilegeContext <TDbContext, TEntity, TRule> context = CreateDataPrivilegeContext(DataOperation.Read); if (context != null) { return(context.Filter(entities)); } return(entities); }
public IQueryable <TEntity> GetAll() { IQueryable <TEntity> table = DbContext.Set <TEntity>(); DataPrivilegeContext <TDbContext, TEntity, TRule> context = CreateDataPrivilegeContext(DataOperation.Read); if (context != null) { table = context.Filter(table); } return(table); }
public void CheckPermission(TEntity entity, DataOperation dataOperation) { DataPrivilegeContext <TDbContext, TEntity, TRule> context = CreateDataPrivilegeContext(dataOperation); if (context != null) { if (!context.CheckPermission(entity)) { throw new NoAccessException(entity, dataOperation); } } }
public void CheckPermission(IEnumerable <TEntity> entities, DataOperation dataOperation) { DataPrivilegeContext <TDbContext, TEntity, TRule> context = CreateDataPrivilegeContext(dataOperation); if (context != null) { if (!context.CheckPermission(entities)) { var data = context.GetNoAccessData(entities); throw new NoAccessException(data, dataOperation); } } }