public void SynchronizePoints() { Courses courseda = new Courses(m_ident); Assignments asstda = new Assignments(m_ident); int total = 0; Course.CourseList courses = courseda.GetAll(); foreach (Course course in courses) { Assignment.AssignmentList assts = courseda.GetAssignments(course.ID); foreach (Assignment asst in assts) { Rubric arub = asstda.GetRubric(asst.ID); Rubric.RubricList rubs = Flatten(arub); Components.Submission.SubmissionList subs = asstda.GetSubmissions(asst.ID); foreach (Rubric rub in rubs) { foreach (Components.Submission sub in subs) { m_dp.UpdateRubricSubPoints(rub.ID, sub.ID); total++; } } } } System.Diagnostics.Trace.WriteLine(total); }
/// <summary> /// Recreate the file permissions table /// </summary> public void RecoverBaseFilePermissions() { //Get all submissions Components.Submission.SubmissionList subs = new Submissions(m_ident).GetAll(); Assignments asstda = new Assignments(m_ident); Courses courseda = new Courses(m_ident); CFilePermission.FilePermissionList full; foreach (Components.Submission sub in subs) { CFile subdir = GetFile(sub.LocationID); int courseID = asstda.GetInfo(sub.AsstID).CourseID; //Give staff access CourseRole.CourseRoleList staff = courseda.GetTypedRoles(courseID, true, null); foreach (CourseRole role in staff) { full = CFilePermission.CreateFullAccess(role.PrincipalID); SetPermissionsInt(subdir, full); } //Give sub principal access full = CFilePermission.CreateOprFullAccess(sub.PrincipalID); SetPermissionsInt(subdir, full); } //Do content Course.CourseList courses = courseda.GetAll(); foreach (Course course in courses) { CFile cont = GetFile(course.ContentID); //Give staff access CourseRole.CourseRoleList staff = courseda.GetTypedRoles(course.ID, true, null); foreach (CourseRole role in staff) { full = CFilePermission.CreateFullAccess(role.PrincipalID); SetPermissionsInt(cont, full); } //Give students read access CourseRole.CourseRoleList stu = courseda.GetTypedRoles(course.ID, false, null); foreach (CourseRole role in stu) { full = new CFilePermission.FilePermissionList(); full.Add(new CFilePermission(role.PrincipalID, FileAction.READ, true)); SetPermissionsInt(cont, full); } //Give staff and stuaccess to asst content Assignment.AssignmentList assts = courseda.GetAssignments(course.ID); foreach (Assignment asst in assts) { CFile acont = GetFile(asst.ContentID); foreach (CourseRole role in staff) { full = CFilePermission.CreateFullAccess(role.PrincipalID); SetPermissionsInt(acont, full); } foreach (CourseRole role in stu) { full = new CFilePermission.FilePermissionList(); full.Add(new CFilePermission(role.PrincipalID, FileAction.READ, true)); SetPermissionsInt(acont, full); } } } }