public static List <Project> GetActiveProposalsVisibleToUser(this IList <Project> projects, Person currentPerson) { var projectViewFeature = new ProjectViewFeature(); return(currentPerson.CanViewProposals ? projects.Where(x => x.IsActiveProposal() && projectViewFeature.HasPermission(currentPerson, x).HasPermission).OrderBy(x => x.DisplayName).ToList() : new List <Project>()); }
public static List <Project> GetAllAssociatedProjectsForOrgVisibleToUser(this Organization organization, Person currentPerson) { var allAsociatedProjects = organization.GrantAllocations.SelectMany(x => x.ProjectGrantAllocationRequests).Select(x => x.Project) .Union(organization.GrantAllocations.SelectMany(x => x.ProjectGrantAllocationExpenditures) .Select(x => x.Project)) .Union(organization.ProjectOrganizations.Select(x => x.Project)) .ToList(); var projectViewFeature = new ProjectViewFeature(); return(allAsociatedProjects.Where(p => projectViewFeature.HasPermission(currentPerson, p).HasPermission).ToList()); }
public static List <Project> GetPendingProjectsVisibleToUser(this IList <Project> projects, Person currentPerson) { var projectViewFeature = new ProjectViewFeature(); return(currentPerson.CanViewPendingProjects ? projects.Where(p => p.IsPendingProject() && projectViewFeature.HasPermission(currentPerson, p).HasPermission).OrderBy(x => x.DisplayName).ToList() : new List <Project>()); }
public static List <Project> GetProposalsVisibleToUser(this IList <Project> projects, Person currentPerson) { var projectViewFeature = new ProjectViewFeature(); return(projects.Where(x => x.IsProposal() && projectViewFeature.HasPermission(currentPerson, x).HasPermission).ToList()); }