def METHOD_NAME(user, uid):
    """
    Update any waiting program enrollments with a user,
    and enroll the user in any waiting course enrollments.
    In most cases this will just short-circuit. Enrollments will only be updated
    for a SAML provider with a linked organization.
    """
    try:
        provider_slug, external_user_key = uid.split(':')
        authorizing_org = SAMLProviderConfig.objects.current_set().get(slug=provider_slug).organization
        if not authorizing_org:
            return
    except (AttributeError, ValueError):
        logger.debug('Ignoring non-saml social auth entry for user=%s', user.id)
        return
    except SAMLProviderConfig.DoesNotExist:
        logger.warning(
            'Got incoming social auth for provider=%s but no such provider exists', provider_slug
        )
        return
    except SAMLProviderConfig.MultipleObjectsReturned:
        logger.warning(
            'Unable to activate waiting enrollments for user=%s.'
            '  Multiple active SAML configurations found for slug=%s. Expected one.',
            user.id,
            provider_slug)
        return
    incomplete_enrollments = fetch_program_enrollments_by_student(
        external_user_key=external_user_key,
        waiting_only=True,
    ).prefetch_related('program_course_enrollments')
    for enrollment in incomplete_enrollments:
        try:
            enrollment_org = get_programs(uuid=enrollment.program_uuid)['authoring_organizations'][0]
            if enrollment_org['key'] != authorizing_org.short_name:
                continue
        except (KeyError, TypeError):
            logger.warning(
                'Failed to complete waiting enrollments for organization=%s.'
                ' No catalog programs with matching authoring_organization exist.',
                authorizing_org.short_name
            )
            continue
        link_program_enrollment_to_lms_user(enrollment, user)