def get_user_lists(self, course, classroomid):
        """ Get the available student and tutor lists for classroom edition"""
        tutor_list = course.get_staff()

        # Determine if user is grouped or not in the classroom
        student_list = list(self.database.classrooms.aggregate([
            {"$match": {"_id": ObjectId(classroomid)}},
            {"$unwind": "$students"},
            {"$project": {
                "students": 1,
                "grouped": {
                    "$anyElementTrue": {
                        "$map": {
                            "input": "$groups.students",
                            "as": "group",
                            "in": {
                                "$anyElementTrue": {
                                    "$map": {
                                        "input": "$$group",
                                        "as": "groupmember",
                                        "in": {"$eq": ["$$groupmember", "$students"]}
                                    }
                                }
                            }
                        }
                    }
                }
            }}
        ]))

        student_list = dict([(student["students"], student) for student in student_list])

        other_students = [entry['students'] for entry in list(self.database.classrooms.aggregate([
            {"$match": {"courseid": course.get_id(), "_id": {"$ne": ObjectId(classroomid)}}},
            {"$unwind": "$students"},
            {"$project": {"_id": 0, "students": 1}}
        ]))]

        users_info = self.user_manager.get_users_info(other_students + list(student_list.keys()) + tutor_list)

        # Order the non-registered students
        other_students = sorted(other_students, key=lambda val: (("0"+users_info[val][0]) if users_info[val] else ("1"+val)))

        return student_list, tutor_list, other_students, users_info
Get the available student and tutor lists for classroom edition