'Return whether the role\'s user has the configured role access to the passed course'

def has_course(self, course_key):

    if (not (self.user.is_authenticated() and self.user.is_active)):
        return False
    if (not hasattr(self.user, '_roles')):
        self.user._roles = RoleCache(self.user)
    return self.user._roles.has_role(self.role, course_key, course_key.org)
