'Register messages to be shown to the user if they have limited access.'

@staticmethod
def register_user_access_warning_messages(request, course_key):

    is_enrolled = CourseEnrollment.is_enrolled(request.user, course_key)
    is_staff = has_access(request.user, 'staff', course_key)
    if request.user.is_anonymous():
        PageLevelMessages.register_warning_message(request, Text(_('To    see    course    content,    {sign_in_link}    or    {register_link}.')).format(sign_in_link=HTML('<a    href="/login?next={current_url}">{sign_in_label}</a>').format(sign_in_label=_('sign    in'), current_url=urlquote_plus(request.path)), register_link=HTML('<a    href="/register?next={current_url}">{register_label}</a>').format(register_label=_('register'), current_url=urlquote_plus(request.path))))
    elif ((not is_enrolled) and (not is_staff)):
        if course_open_for_self_enrollment(course_key):
            enroll_message = _('You    must    be    enrolled    in    the    course    to    see    course    content.                                                                                                    {enroll_link_start}Enroll    now{enroll_link_end}.')
            PageLevelMessages.register_warning_message(request, Text(enroll_message).format(enroll_link_start=HTML('<button    class="enroll-btn    btn-link">'), enroll_link_end=HTML('</button>')))
        else:
            PageLevelMessages.register_warning_message(request, Text(_('You    must    be    enrolled    in    the    course    to    see    course    content.')))
