Example #1
4
 public SearchController(IService<SearchRequest, SearchModel> service, IStudentSchoolAreaLinks studentSchoolLinks, ICurrentUserClaimInterrogator currentUserClaimInterrogator, IGradeLevelUtilitiesProvider gradeLevelUtilitiesProvider)
 {
     this.service = service;
     this.studentSchoolLinks = studentSchoolLinks;
     this.currentUserClaimInterrogator = currentUserClaimInterrogator;
     this.gradeLevelUtilitiesProvider = gradeLevelUtilitiesProvider;
 }
 public MetricActionUrlAuthorizationProvider(IConfigSectionProvider configSectionProvider, ICurrentUserClaimInterrogator currentUserClaimInterrogator)
 {
     this.currentUserClaimInterrogator = currentUserClaimInterrogator;
     locationAuthorizationSection = configSectionProvider.GetSection(LocationAuthorizationConfiguration.SectionName) as LocationAuthorizationConfiguration;
     if (locationAuthorizationSection == null)
         throw new ConfigurationErrorsException("Missing Configuration Section '" + LocationAuthorizationConfiguration.SectionName + "'.");
 }
Example #3
0
 public SecurityFilter(
     IRepository<StaffStudentAssociation> staffStudentAssociationRepository,
     ICurrentUserClaimInterrogator currentUserClaimInterrogator)
 {
     StaffStudentAssociationRepository = staffStudentAssociationRepository;
     CurrentUserClaimInterrogator = currentUserClaimInterrogator;
 }
 protected override void EstablishContext()
 {
     containerMock = new WindsorContainer();
     IoC.Initialize(containerMock);
     configStoreMock = mocks.DynamicMock<IConfigurationStore>();
     currentUserClaimInterrogator = mocks.DynamicMock<ICurrentUserClaimInterrogator>();
     dbConnectionStringSelector = mocks.DynamicMock<IDbConnectionStringSelector>();
     subsonicDataProviderProvider = mocks.DynamicMock<ISubsonicDataProviderProvider>();
 }
 public PriorYearStudentMetricsProvider(
     IRepository<StudentSchoolMetricInstance> studentSchoolMetricInstanceRepository,
     IStateAssessmentMetricIdGroupingProvider stateAssessmentMetricIdGroupingProvider,
     ICurrentUserClaimInterrogator currentUserClaimInterrogator,
     IRepository<SchoolMetricInstanceStudentList> schoolMetricStudentListRepository)
 {
     this.studentSchoolMetricInstanceRepository = studentSchoolMetricInstanceRepository;
     this.stateAssessmentMetricIdGroupingProvider = stateAssessmentMetricIdGroupingProvider;
     this.currentUserClaimInterrogator = currentUserClaimInterrogator;
     this.schoolMetricStudentListRepository = schoolMetricStudentListRepository;
 }
Example #6
0
 public SiteAvailableProvider(IRepository<LocalEducationAgencyAdministration> repository, 
     ICacheProvider cacheProvider, IConfigValueProvider configValueProvider, 
     ICurrentUserClaimInterrogator currentUserClaimInterrogator,
     ICacheKeyGenerator cacheKeyGenerator)
 {
     this.repository = repository;
     this.cacheProvider = cacheProvider;
     this.configValueProvider = configValueProvider;
     this.currentUserClaimInterrogator = currentUserClaimInterrogator;
     this.cacheKeyGenerator = cacheKeyGenerator;
 }
Example #7
0
        protected override void EstablishContext()
        {
            base.EstablishContext();

            staffStudentAssociationRepository = mocks.StrictMock<IRepository<StaffStudentAssociation>>();
            rootMetricNodeResolver = mocks.StrictMock<IRootMetricNodeResolver>();
            currentUserClaimInterrogator = mocks.StrictMock<ICurrentUserClaimInterrogator>();

            windsorContainer = new WindsorContainer();
            RegisterProviders(windsorContainer);

            userEntryProvider = windsorContainer.Resolve<IUserEntryProvider>();

            Expect.Call(staffStudentAssociationRepository.GetAll()).Repeat.Any().Return(GetStaffStudentAssociations());
            Expect.Call(rootMetricNodeResolver.GetRootMetricNodeForSchool(suppliedSchoolId)).Repeat.Any().Return(new MetricMetadataNode (new TestMetricMetadataTree()) {MetricId = suppliedMetricId});

            Thread.CurrentPrincipal = suppliedUserInformation.ToClaimsPrincipal();
        }
 public CurrentUserAccessibleStudentsProvider(IAuthorizationInformationProvider authorizationInformationProvider, ICurrentUserClaimInterrogator currentUserClaimInterrogator)
 {
     this.authorizationInformationProvider = authorizationInformationProvider;
     this.currentUserClaimInterrogator = currentUserClaimInterrogator;
 }
Example #9
0
        protected override void EstablishContext()
        {
            canAccessSchool = true;
            metricActionUrlAuthService = mocks.StrictMock<IMetricActionUrlAuthorizationProvider>();
            Expect.Call(metricActionUrlAuthService.CurrentUserHasAccessToPath(String.Empty,0)).Repeat.Any().IgnoreArguments().Return(true);

            currentUserClaimInterrogator = mocks.StrictMock<ICurrentUserClaimInterrogator>();

            var userAssociatedOrgs = UserInformation.Current.AssociatedSchools;
            foreach (var associatedOrg in userAssociatedOrgs)
            {
                foreach (var claimType in associatedOrg.ClaimTypes)
                {
                    Expect.Call(currentUserClaimInterrogator.HasClaimWithinEducationOrganizationHierarchy(claimType, associatedOrg.EducationOrganizationId
                                                                                                          )).Repeat.Any().Return(true);
                    Expect.Call(currentUserClaimInterrogator.HasClaimForLocalEducationAgencyWithinEducationOrganizationHierarchy(claimType, associatedOrg.EducationOrganizationId)).Repeat.Any().Return(false);
                    
                    if (claimType == EdFiClaimTypes.ViewAllMetrics)
                    {
                        Expect.Call(currentUserClaimInterrogator.HasClaimForMetricWithinEducationOrganizationHierarchy(0, 0)).Repeat.Any().Constraints(Rhino.Mocks.Constraints.Is.TypeOf<int>(), Rhino.Mocks.Constraints.Is.Equal(associatedOrg.EducationOrganizationId)).Return(true);
                    }
                    else if (claimType == EdFiClaimTypes.ViewMyMetrics)
                    {
                        Expect.Call(currentUserClaimInterrogator.HasClaimForMetricWithinEducationOrganizationHierarchy(0, 0)).Repeat.Any().Constraints(Rhino.Mocks.Constraints.Is.TypeOf<int>() && !Rhino.Mocks.Constraints.Is.Equal((int)SchoolMetricEnum.OperationsDashboard), Rhino.Mocks.Constraints.Is.Equal(associatedOrg.EducationOrganizationId)).Return(true);
                    }
                }
            }
            var userAssociatedLeaOrgs = UserInformation.Current.AssociatedLocalEducationAgencies;
            foreach (var associatedOrg in userAssociatedLeaOrgs)
            {
                foreach (var claimType in associatedOrg.ClaimTypes)
                {
                    Expect.Call(currentUserClaimInterrogator.HasClaimWithinEducationOrganizationHierarchy(claimType, associatedOrg.EducationOrganizationId
                                                                                                          )).Repeat.Any().Return(true);
                    Expect.Call(currentUserClaimInterrogator.HasClaimForLocalEducationAgencyWithinEducationOrganizationHierarchy(claimType, associatedOrg.EducationOrganizationId)).Repeat.Any().Return(true);

                    if (claimType == EdFiClaimTypes.ViewAllMetrics)
                    {
                        Expect.Call(currentUserClaimInterrogator.HasClaimForMetricWithinEducationOrganizationHierarchy(0, 0)).Repeat.Any().Constraints(Rhino.Mocks.Constraints.Is.TypeOf<int>(), Rhino.Mocks.Constraints.Is.TypeOf<int>()).Return(true); 
                    }
                    else if (claimType == EdFiClaimTypes.ViewMyMetrics)
                    {
                        Expect.Call(currentUserClaimInterrogator.HasClaimForMetricWithinEducationOrganizationHierarchy(0, 0)).Repeat.Any().Constraints(Rhino.Mocks.Constraints.Is.TypeOf<int>() && !Rhino.Mocks.Constraints.Is.Equal((int)LocalEducationAgencyMetricEnum.OperationsDashboard), Rhino.Mocks.Constraints.Is.Equal(associatedOrg.EducationOrganizationId)).Return(true); 
                    }
                }
            }

            if (!userAssociatedLeaOrgs.Any(o => o.ClaimTypes.Any(t => t == EdFiClaimTypes.ViewAllMetrics)))
            {
                Expect.Call(currentUserClaimInterrogator.HasClaimForLocalEducationAgencyWithinEducationOrganizationHierarchy(EdFiClaimTypes.ViewAllMetrics, 0)).Repeat.Any().Return(false).IgnoreArguments();
                Expect.Call(currentUserClaimInterrogator.HasClaimForMetricWithinEducationOrganizationHierarchy(0, 0)).Repeat.Any().Constraints(Rhino.Mocks.Constraints.Is.TypeOf<int>(), Rhino.Mocks.Constraints.Is.TypeOf<int>()).Return(false);
            }
            Expect.Call(currentUserClaimInterrogator.HasClaimForStateAgency(string.Empty)).Repeat.Any().Return(false).IgnoreArguments();
            
            windsorContainer = new WindsorContainer();
            RegisterServices(windsorContainer);

            CreateEdFiDashboardContext(LoginHelper.localEducationAgencyOneId, LoginHelper.schoolOneId);

            base.EstablishContext();
        }
Example #10
0
        protected override void EstablishContext()
        {
            metricActionUrlAuthService = mocks.StrictMock<IMetricActionUrlAuthorizationProvider>();
            configSectionProvider = mocks.StrictMock<IConfigSectionProvider>();
            currentUserClaimInterrogator = mocks.StrictMock<ICurrentUserClaimInterrogator>();
            windsorContainer = new WindsorContainer();
            RegisterServices(windsorContainer);
            LoginHelper.LoginSuperintendent();
            int lea =
                LoginHelper.userInfoSuperintendent.AssociatedLocalEducationAgencies.Single().EducationOrganizationId;
            CreateEdFiDashboardContext(lea,null);

            foreach (var associatedOrganizations in LoginHelper.userInfoSuperintendent.AssociatedOrganizations)
            {
                foreach (var claimType in associatedOrganizations.ClaimTypes)
                {
                    Expect.Call(currentUserClaimInterrogator.HasClaimWithinEducationOrganizationHierarchy(claimType,associatedOrganizations.EducationOrganizationId)).Repeat.Any().Return(true);
                    Expect.Call(currentUserClaimInterrogator.HasClaimForLocalEducationAgencyWithinEducationOrganizationHierarchy(claimType, associatedOrganizations.EducationOrganizationId)).Repeat.Any().Return(true);
                    if (claimType == EdFiClaimTypes.ViewAllMetrics)
                    {
                        Expect.Call(currentUserClaimInterrogator.HasClaimForMetricWithinEducationOrganizationHierarchy(0, 0)).Repeat.Any().Constraints(Rhino.Mocks.Constraints.Is.TypeOf<int>(), Rhino.Mocks.Constraints.Is.Equal(associatedOrganizations.EducationOrganizationId)).Return(true);
                    }
                }
            }

            

            //Test is focusing on this!!! The logic to add or filter/remove actions
            Expect.Call(metricActionUrlAuthService.CurrentUserHasAccessToPath("~/aaa.aspx",lea)).Return(true);
            Expect.Call(metricActionUrlAuthService.CurrentUserHasAccessToPath("~/bbb.aspx",lea)).Return(false);
        }
 public SecurityAssertionProvider(IAuthorizationInformationProvider authorizationInformationProvider,
                                   ICurrentUserClaimInterrogator currentUserClaimInterrogator)
 {
     _authorizationInformationProvider = authorizationInformationProvider;
     this.currentUserClaimInterrogator = currentUserClaimInterrogator;
 }
Example #12
0
        protected override void EstablishContext()
        {
            windsorContainer = new WindsorContainer();
            authorizationInformationProvider = mocks.StrictMock<IAuthorizationInformationProvider>();
            sessionStateProvider = mocks.StrictMock<ISessionStateProvider>();
            currentUserClaimInterrogator = mocks.StrictMock<ICurrentUserClaimInterrogator>();
            currentUserAccessibleStudentsProvider = mocks.StrictMock<ICurrentUserAccessibleStudentsProvider>();
            RegisterServices(windsorContainer);
            var userAssociatedOrgs = UserInformation.Current.AssociatedSchools;
            foreach(var associatedOrg in userAssociatedOrgs)
            {
                foreach(var claimType in associatedOrg.ClaimTypes)
                {
                    Expect.Call(currentUserClaimInterrogator.HasClaimWithinEducationOrganizationHierarchy(claimType,associatedOrg.EducationOrganizationId
                                                                                                          )).Repeat.Any().Return(true);
                }
            }
            var userAssociatedLeaOrgs = UserInformation.Current.AssociatedLocalEducationAgencies;
            foreach (var associatedOrg in userAssociatedLeaOrgs)
            {
                foreach (var claimType in associatedOrg.ClaimTypes)
                {
                    Expect.Call(currentUserClaimInterrogator.HasClaimWithinEducationOrganizationHierarchy(claimType, associatedOrg.EducationOrganizationId
                                                                                                          )).Repeat.Any().Return(true);
                }
            }
            Expect.Call(currentUserClaimInterrogator.HasClaimForStateAgency(string.Empty)).Repeat.Any().Return(false).IgnoreArguments();
            
            CreateEdFiDashboardContext(LoginHelper.localEducationAgencyOneId);

            if (registerAccessibleStudentsInBase)
                Expect.Call(currentUserAccessibleStudentsProvider.GetAccessibleStudents(1, false)).IgnoreArguments().Repeat.
                    Any().Return(new AccessibleStudents { CanAccessAllStudents = false, StudentUSIs = GetAllStaffStudents() });

            //Expect.Call(authorizationInformationProvider.GetAllStaffStudentUSIs(providedStaffUSI)).Repeat.Any().Return(GetAllStaffStudents());

            //Expect.Call(authorizationInformationProvider.GetPrincipalStudentUSIs(providedStaffUSI)).Repeat.Any().Return(GetPrincipalStudents());
            //Expect.Call(authorizationInformationProvider.GetStaffCohortStudentUSIs(providedStaffUSI)).Repeat.Any().Return(GetCohortStudents());
            //Expect.Call(authorizationInformationProvider.GetTeacherStudentUSIs(providedStaffUSI)).Repeat.Any().Return(GetTeacherStudents());

            base.EstablishContext();
        }
Example #13
0
 public QuickSearchController(IService<QuickSearchRequest, QuickSearchModel> service, IRootMetricNodeResolver rootMetricNodeResolver, IStudentSchoolAreaLinks studentSchoolLinks, ICurrentUserClaimInterrogator currentUserClaimInterrogator)
 {
     this.service = service;
     this.rootMetricNodeResolver = rootMetricNodeResolver;
     this.studentSchoolLinks = studentSchoolLinks;
 }
Example #14
0
        protected override void EstablishContext()
        {
            providedStaffUSI = providedStaffUSI1;
            providedUserName = "******";
            providedUserInformation = new UserInformation
            {
                StaffUSI = providedStaffUSI,
                FullName = providedFullName,
                AssociatedOrganizations = new List<UserInformation.EducationOrganization>
                                                                            {
                                                                                new UserInformation.School(providedLocalEducationAgencyId, providedSchoolId)
                                                                                { 
                                                                                    Name = providedSchoolName, 
                                                                                },
                                                                                new UserInformation.School(providedLocalEducationAgencyId, providedSchoolId + 1)
                                                                                { 
                                                                                    Name = providedSchoolName1,
                                                                                },
                                                                                new UserInformation.School(providedLocalEducationAgencyId, providedSchoolId + 2)
                                                                                { 
                                                                                    Name = providedSchoolName2,
                                                                                },
                                                                                new UserInformation.School(providedLocalEducationAgencyId, providedSchoolId + 3)
                                                                                { 
                                                                                    Name = providedSchoolName3,
                                                                                },
                                                                            }
            };

            suppliedViewType = StaffModel.ViewType.SubjectSpecificOverview.ToString();

            staffCohortRepository = mocks.StrictMock<IRepository<StaffCohort>>();
            Expect.Call(staffCohortRepository.GetAll()).Return(GetStaffCohort());
            
            staffInfoRepository = mocks.StrictMock<IRepository<StaffInformation>>();
            Expect.Call(staffInfoRepository.GetAll()).Return(GetStaffInformation());

            teacherSectionRepository = mocks.StrictMock<IRepository<TeacherSection>>();
            Expect.Call(teacherSectionRepository.GetAll()).Repeat.Any().Return(GetTeacherSection());

            schoolInformationRepository = mocks.StrictMock<IRepository<SchoolInformation>>();
            Expect.Call(schoolInformationRepository.GetAll()).Repeat.Any().Return(GetSchoolInformation());

            WatchListRepository = mocks.StrictMock<IRepository<MetricBasedWatchList>>();
            Expect.Call(WatchListRepository.GetAll()).Repeat.Any().Return(GetWatchListInformation());

            WatchListOptionRepository = mocks.StrictMock<IRepository<MetricBasedWatchListOption>>();
            Expect.Call(WatchListOptionRepository.GetAll()).Repeat.Any().Return(GetWatchListOptionInformation());

            currentUserClaimInterrogator = mocks.StrictMock<ICurrentUserClaimInterrogator>();
            Expect.Call(currentUserClaimInterrogator.HasClaimWithinEducationOrganizationHierarchy(String.Empty, 0)).
                IgnoreArguments().Repeat.Any().Return(true);

            LoginUser(providedUserInformation);

            base.EstablishContext();
        }
 protected void CreateSecurityMocks(MockRepository mocks)
 {
     myAuthorizationInformationProvider = mocks.StrictMock<IAuthorizationInformationProvider>();
     _schoolIdNameService = mocks.StrictMock<IIdNameService>();
     currentUserClaimInterrogator = mocks.StrictMock<ICurrentUserClaimInterrogator>();
     mySecurityAssertionProvider = new SecurityAssertionProvider(myAuthorizationInformationProvider,currentUserClaimInterrogator);
     mySecurityAssertionProvider.SetSchoolIdNameService(_schoolIdNameService);
     SupportedClaimNamesProvider = mocks.StrictMock<ISupportedClaimNamesProvider>();
 }
 protected override void EstablishContext()
 {
     AuthorizationInformationProvider = mocks.StrictMock<IAuthorizationInformationProvider>();
     CurrentUserClaimInterrogator = mocks.StrictMock<ICurrentUserClaimInterrogator>();
 }
Example #17
0
        //private readonly StaffModel staffModel;

        public StaffLayoutController(IService<StaffRequest, StaffModel> staffService, ICurrentUserClaimInterrogator currentUserClaimInterrogator)
        {
            this.staffService = staffService;
            this.currentUserClaimInterrogator = currentUserClaimInterrogator;
        }
Example #18
0
        protected override void EstablishContext()
        {
            providedStaffImage = staffAreaLinksFake.Image(providedSchoolId, providedStaffUSI1, providedStaffGender);
            providedThumbnail = staffAreaLinksFake.ProfileThumbnail(providedSchoolId, providedStaffUSI1, providedStaffGender);

            staffCohortRepository = mocks.StrictMock<IRepository<StaffCohort>>();
            Expect.Call(staffCohortRepository.GetAll()).Repeat.Any().Return(GetStaffCohort());

            staffCustomStudentListRepository = mocks.StrictMock<IRepository<StaffCustomStudentList>>();
            Expect.Call(staffCustomStudentListRepository.GetAll()).Return(GetStaffCustomStudentList());

            staffInfoRepository = mocks.StrictMock<IRepository<StaffInformation>>();
            Expect.Call(staffInfoRepository.GetAll()).Return(GetStaffInformation());

            teacherSectionRepository = mocks.StrictMock<IRepository<TeacherSection>>();
            Expect.Call(teacherSectionRepository.GetAll()).Repeat.Any().Return(GetTeacherSection());
            
            schoolInformationRepository = mocks.StrictMock<IRepository<SchoolInformation>>();
            Expect.Call(schoolInformationRepository.GetAll()).Repeat.Any().Return(GetSchoolInformation());

            WatchListRepository = mocks.StrictMock<IRepository<MetricBasedWatchList>>();
            Expect.Call(WatchListRepository.GetAll()).Repeat.Any().Return(GetWatchListInformation());

            WatchListOptionRepository = mocks.StrictMock<IRepository<MetricBasedWatchListOption>>();
            Expect.Call(WatchListOptionRepository.GetAll()).Repeat.Any().Return(GetWatchListOptionInformation());

            currentUserClaimInterrogator = mocks.StrictMock<ICurrentUserClaimInterrogator>();
            Expect.Call(currentUserClaimInterrogator.HasClaimWithinEducationOrganizationHierarchy(String.Empty, 0)).
                IgnoreArguments().Repeat.Any().Return(true);

            watchListLinkProvider = mocks.StrictMock<IWatchListLinkProvider>();
            Expect.Call(watchListLinkProvider.GenerateLink(null)).
                IgnoreArguments().Repeat.Any().Return("http://testlink");

            LoginUser(providedUserInformation);

            base.EstablishContext();
        }
Example #19
0
        protected override void EstablishContext()
        {
            base.EstablishContext();

            staffStudentAssociationRepository = mocks.StrictMock<IRepository<StaffStudentAssociation>>();
            rootMetricNodeResolver = mocks.StrictMock<IRootMetricNodeResolver>();
            currentUserClaimInterrogator = mocks.StrictMock<ICurrentUserClaimInterrogator>();
            windsorContainer = new WindsorContainer();
            RegisterProviders(windsorContainer);

            userEntryProvider = windsorContainer.Resolve<IUserEntryProvider>();

            var suppliedUserInformation = new UserInformation
                                                {
                                                    StaffUSI = suppliedStaffUSI,
                                                    AssociatedOrganizations = new List<UserInformation.EducationOrganization>()
                                                                                {
                                                                                    new UserInformation.School(suppliedLocalEducationAgencyId, suppliedSchoolId)
                                                                                        {
                                                                                            ClaimTypes = new List<string>
                                                                                                                {
                                                                                                                    EdFiClaimTypes.ViewAllTeachers
                                                                                                                }
                                                                                        }
                                                                                }
                                                };
            Thread.CurrentPrincipal = suppliedUserInformation.ToClaimsPrincipal();
        }