コード例 #1
0
 protected override object HandleRequest(ClaimValidatorRequest request)
 {
     var staffUSI = request.GetNullableLongIdByName(ClaimValidatorRequest.StaffParameterName);
     if (staffUSI.HasValue)
     {
         var schoolId = request.GetNullableIdByName(ClaimValidatorRequest.SchoolParameterName);
         if (schoolId.HasValue)
             ValidateClaimSchoolStaff(request, ClaimType);
         else
             ValidateClaimLocalEducationAgencyStaff(request, ClaimType);
     }
     else
     {
         var schoolId = request.GetNullableIdByName(ClaimValidatorRequest.SchoolParameterName);
         if (schoolId.HasValue)
             ValidateClaimSchool(request, ClaimType);
         else
             ValidateClaimLocalEducationAgency(request, ClaimType);
     }
     return null;
 }
コード例 #2
0
        protected override object HandleRequest(ClaimValidatorRequest request)
        {
            var studentListType = request.GetParameterValueByName(ClaimValidatorRequest.StudentListTypeParameterName);
            var schoolId = request.GetNullableIdByName(ClaimValidatorRequest.SchoolParameterName);
            var staffUSI = request.GetNullableLongIdByName(ClaimValidatorRequest.StaffParameterName);

            // DJWhite 4 Jan 2012: Default null or empty to NONE which is equivalent to ALL.
            if (String.IsNullOrEmpty(studentListType)) studentListType = StudentListType.None.ToString();

            switch (studentListType.ToLower())
            {
                case ClaimValidatorRequest.StudentListEnumSection:
                    if (!schoolId.HasValue)
                        throw new UserAccessDeniedException(ClaimValidatorRequest.InvalidParameterErrorMessage);

                    if (staffUSI.HasValue)
                        ValidateClaimSchoolStaffSection(request, ClaimType);
                    else
                        ValidateClaimSchoolSection(request, ClaimType);
                    break;
                case ClaimValidatorRequest.StudentListEnumCohort:
                    if (staffUSI.HasValue)
                    {
                        if (schoolId.HasValue)
                            ValidateClaimSchoolCohortStaff(request, ClaimType);
                        else
                            ValidateClaimLocalEducationAgencyCohortStaff(request, ClaimType);
                    }
                    else
                    {
                        if (schoolId.HasValue)
                            ValidateClaimSchoolCohort(request, ClaimType);
                        else
                            ValidateClaimLocalEducationAgencyCohort(request, ClaimType);
                    }
                    break;
                case ClaimValidatorRequest.StudentListEnumCustomStudentList:
                    ValidateClaimSchoolCustomStudentListStaff(request, ClaimType);
                    break;
                case ClaimValidatorRequest.StudentListEnumMetricsBasedWatchList:
                case ClaimValidatorRequest.StudentListEnumAll:
                case ClaimValidatorRequest.StudentListEnumNone:
                    if (staffUSI.HasValue)
                    {
                        if (schoolId.HasValue)
                            ValidateClaimSchoolStaff(request, ClaimType);
                        else
                            ValidateClaimLocalEducationAgencyStaff(request, ClaimType);
                    }
                    else
                    {
                        if (schoolId.HasValue)
                            ValidateClaimSchool(request, ClaimType);
                        else
                            ValidateClaimLocalEducationAgency(request, ClaimType);
                    }
                    break;
                default:
                    throw new UserAccessDeniedException(ClaimValidatorRequest.InvalidParameterErrorMessage);
            }

            return null;
        }