protected override Framework Filter(Framework input) { if (!_context.HasRole(Roles.Supplier)) { return(input); } // Supplier: only own Solutions var orgId = _context.HttpContext.User.Claims .Where(x => x.Type == nameof(Organisation)) .Select(x => x.Value) .SingleOrDefault(); if (orgId is null) { return(null); } var frameworkIds = _solutionDatastore .ByOrganisation(orgId) .SelectMany(soln => _frameworkDatastore.BySolution(soln.Id)) .Select(fw => fw.Id); return(frameworkIds.Contains(input.Id) ? input : null); }
public IQueryable <Solution> ByOrganisation(string organisationId) { return(_filter.Filter(_datastore.ByOrganisation(organisationId))); }