コード例 #1
0
        public IList <AnnouncementDetails> GetAnnouncementDetailses(DateTime?fromDate, DateTime?toDate, int?classId, bool?complete, AnnouncementTypeEnum?announcementType)
        {
            var res = new List <AnnouncementDetails>();

            if (!BaseSecurity.IsTeacher(Context) && !classId.HasValue)
            {
                if (!announcementType.HasValue || announcementType == AnnouncementTypeEnum.Admin)
                {
                    res.AddRange(ServiceLocator.AdminAnnouncementService.GetAnnouncementDetailses(fromDate, toDate, null, complete, true));
                }
            }
            if (!BaseSecurity.IsDistrictAdmin(Context) || classId.HasValue)
            {
                var onlyOwners = !Context.Claims.HasPermission(ClaimInfo.VIEW_CLASSROOM_ADMIN);

                if (!announcementType.HasValue || announcementType == AnnouncementTypeEnum.Class)
                {
                    res.AddRange(ServiceLocator.ClassAnnouncementService.GetAnnouncementDetailses(fromDate, toDate, classId, complete, onlyOwners));
                }

                if (!announcementType.HasValue || announcementType == AnnouncementTypeEnum.LessonPlan)
                {
                    res.AddRange(ServiceLocator.LessonPlanService.GetAnnouncementDetailses(fromDate, toDate, classId, complete, onlyOwners));
                }

                if (!announcementType.HasValue || announcementType == AnnouncementTypeEnum.Supplemental)
                {
                    res.AddRange(ServiceLocator.SupplementalAnnouncementService.GetAnnouncementDetailses(fromDate, toDate, classId, complete, onlyOwners));
                }
            }
            return(res);
        }
コード例 #2
0
        private PaginatedList <StudentSchoolsInfo> SearchStudents(string query)
        {
            var teacherId = BaseSecurity.IsTeacher(Context) && !Context.Claims.HasPermission(ClaimInfo.VIEW_STUDENT) ? Context.PersonId : null;
            var studentId = Context.Role == CoreRoles.STUDENT_ROLE ? Context.PersonId : null;

            return(SchoolLocator.StudentService.SearchStudents(Context.SchoolYearId.Value, null, null, null, null, teacherId, studentId, query, true, 0, 15, null, true));
        }
コード例 #3
0
 private bool CanSendMessageToPerson(int personId, UnitOfWork uow)
 {
     if (BaseSecurity.IsTeacher(Context))
     {
         return(CanTeacherSendMessage(personId, uow) && PrivateMessageSecurity.CanSendMessage(Context));
     }
     if (Context.Role == CoreRoles.STUDENT_ROLE)
     {
         return(CanStudentSendMessage(personId, uow) && PrivateMessageSecurity.CanSendMessage(Context));
     }
     return(PrivateMessageSecurity.CanSendMessage(Context));
 }
コード例 #4
0
        public IList <Announcement> GetAnnouncementsByFilter(string filter)
        {
            var res = new List <Announcement>();

            if (BaseSecurity.IsDistrictAdmin(Context) || CoreRoles.STUDENT_ROLE == Context.Role)
            {
                res.AddRange(ServiceLocator.AdminAnnouncementService.GetAdminAnnouncementsByFilter(filter));
            }
            if (BaseSecurity.IsTeacher(Context) || CoreRoles.STUDENT_ROLE == Context.Role)
            {
                res.AddRange(ServiceLocator.LessonPlanService.GetLessonPlansbyFilter(filter));
                res.AddRange(ServiceLocator.ClassAnnouncementService.GetClassAnnouncementsByFilter(filter));
            }
            return(res.OrderBy(x => x.Created).ToList());
        }
コード例 #5
0
        public LEParams GetLEParams()
        {
            var hasLeAccess = HasLEAccess();

            return(new LEParams
            {
                LEEnabled = Context.LEEnabled,
                LESyncComplete = Context.LESyncComplete,
                LELinkStatus = IsLELinkActive(),
                LEBaseUrl = GetBaseUrl(),
                AwardLECredits = HasLECreditsPermission(),
                AwardLECreditsClassroom = HasLECreditsClassroomPermission(),
                IssueLECreditsEnabled = hasLeAccess && BaseSecurity.IsTeacher(Context),
                LEAccessEnabled = hasLeAccess,
            });
        }
コード例 #6
0
        private bool CanChangeUserLogin(User user)
        {
            var res = UserSecurity.CanModify(Context, user);

            if (!res && Context.DistrictId.HasValue && user.SisUserId.HasValue && BaseSecurity.IsTeacher(Context))
            {
                int roleId;
                var personId = PersonDataAccess.GetPersonDataForLogin(Context.DistrictServerUrl, Context.DistrictId.Value, user.SisUserId.Value, out roleId);
                if (roleId == CoreRoles.STUDENT_ROLE.Id)
                {
                    var schooLocator = ServiceLocator.SchoolServiceLocator(Context.DistrictId.Value, Context.SchoolLocalId);
                    res = (Context.PersonId.HasValue && Context.SchoolYearId.HasValue &&
                           schooLocator.StudentService.IsTeacherStudent(Context.PersonId.Value, personId, Context.SchoolYearId.Value));
                }
            }
            return(res);
        }
コード例 #7
0
 public override bool CanAddStandard(int announcementId)
 {
     return(DoRead(u => BaseSecurity.IsTeacher(Context) && CreateLessonPlanDataAccess(u).CanAddStandard(announcementId)));
 }
コード例 #8
0
 private bool CanGiveCredits()
 {
     return(Context.LEEnabled && Context.LESyncComplete && HasLEAccess() &&
            IsLELinkActive() && BaseSecurity.IsTeacher(Context));
 }
コード例 #9
0
 private bool CanSendMessageToClass(int classId, UnitOfWork uow)
 {
     return(PrivateMessageSecurity.CanSendMessage(Context) &&
            BaseSecurity.IsTeacher(Context) && Context.TeacherStudentMessaginEnabled &&
            (!Context.TeacherClassMessagingOnly || new ClassTeacherDataAccess(uow).Exists(classId, Context.PersonId)));
 }