コード例 #1
0
        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);
        }
コード例 #2
0
 public IQueryable <Solution> ByOrganisation(string organisationId)
 {
     return(_filter.Filter(_datastore.ByOrganisation(organisationId)));
 }