'Looks at the currently active configuration model to determine whether
the feature that enables editing of "request username" and "request email"
fields of LTI consumer is available or not.
Backwards Compatibility:
Enable this feature for a course run who was sharing learner username/email
in the past.
Arguments:
course_id (CourseKey): course id for which we need to check this configuration
is_already_sharing_learner_info (bool): indicates whether LTI consumer is
already sharing edX learner username/email.'

@classmethod
@request_cached
def lti_access_to_learners_editable(cls, course_id, is_already_sharing_learner_info):

    course_specific_config = CourseEditLTIFieldsEnabledFlag.objects.filter(course_id=course_id).order_by('-change_date').first()
    if is_already_sharing_learner_info:
        if (not course_specific_config):
            CourseEditLTIFieldsEnabledFlag.objects.create(course_id=course_id, enabled=True)
            return True
    return (course_specific_config.enabled if course_specific_config else False)
