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); }
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)); }
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)); }
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()); }
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, }); }
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); }
public override bool CanAddStandard(int announcementId) { return(DoRead(u => BaseSecurity.IsTeacher(Context) && CreateLessonPlanDataAccess(u).CanAddStandard(announcementId))); }
private bool CanGiveCredits() { return(Context.LEEnabled && Context.LESyncComplete && HasLEAccess() && IsLELinkActive() && BaseSecurity.IsTeacher(Context)); }
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))); }