def _accessible_courses_list_from_groups(request):
 def filter_ccx(course_access):
  ' CCXs cannot be edited in Studio and should not be shown in this dashboard '
  return (not isinstance(course_access.course_id, CCXLocator))
 courses_list = {}
 in_process_course_actions = []
 instructor_courses = UserBasedRole(request.user, CourseInstructorRole.ROLE).courses_with_role()
 staff_courses = UserBasedRole(request.user, CourseStaffRole.ROLE).courses_with_role()
 all_courses = filter(filter_ccx, (instructor_courses | staff_courses))
 for course_access in all_courses:
  course_key = course_access.course_id
  if (course_key is None):
   raise AccessListFallback
  if (course_key not in courses_list):
   in_process_course_actions.extend(CourseRerunState.objects.find_all(exclude_args={'state': CourseRerunUIStateManager.State.SUCCEEDED}, should_display=True, course_key=course_key))
   try:
    course = modulestore().get_course(course_key)
   except ItemNotFoundError:
    pass
   if ((course is not None) and (not isinstance(course, ErrorDescriptor))):
    courses_list[course_key] = course
 return (courses_list.values(), in_process_course_actions)

def _accessible_courses_list_from_groups ( request ) : def filter_ccx ( course_access ) : return ( not isinstance ( course_access . course_id , CCXLocator ) ) courses_list = { } in_process_course_actions = [ ] instructor_courses = UserBasedRole ( request . user , CourseInstructorRole . ROLE ) . courses_with_role ( ) staff_courses = UserBasedRole ( request . user , CourseStaffRole . ROLE ) . courses_with_role ( ) all_courses = filter ( filter_ccx , ( instructor_courses | staff_courses ) ) for course_access in all_courses : course_key = course_access . course_id if ( course_key is None ) : raise AccessListFallback if ( course_key not in courses_list ) : in_process_course_actions . extend ( CourseRerunState . objects . find_all ( exclude_args = { 'state' : CourseRerunUIStateManager . State . SUCCEEDED } , should_display = True , course_key = course_key ) ) try : course = modulestore ( ) . get_course ( course_key ) except ItemNotFoundError : pass if ( ( course is not None ) and ( not isinstance ( course , ErrorDescriptor ) ) ) : courses_list [ course_key ] = course return ( courses_list . values ( ) , in_process_course_actions )
list all courses available to the logged in user by reversing access group names .