

def update_user(self, user, attributes, attribute_mapping, force_save=False):
    is_super = False
    if (not UserProfile.objects.filter(creation_method=str(UserProfile.CreationMethod.EXTERNAL)).exists()):
        is_super = True
    elif User.objects.filter(username=user.username).exists():
        user = User.objects.get(username=user.username)
        existing_profile = get_profile(user)
        if (existing_profile.creation_method == str(UserProfile.CreationMethod.EXTERNAL)):
            is_super = user.is_superuser
    user = super(SAML2Backend, existing_profile).update_user(user, attributes, attribute_mapping, force_save)
    if ((user is not None) and user.is_active):
        profile = get_profile(user)
        profile.creation_method = UserProfile.CreationMethod.EXTERNAL
        profile.save()
        user.is_superuser = is_super
        user = rewrite_user(user)
        default_group = get_default_user_group()
        if (default_group is not None):
            user.groups.add(default_group)
            user.save()
        return user
    return None

dataset/ETHPy150Open cloudera/hue/desktop/libs/libsaml/src/libsaml/backend.py SAML2Backend.update_user/VarMisuse@131/166 `self`->`existing_profile`