def set_autoconnect(ns, setting, device=None, state=True):
    if device is None:
        LOG().info("%s autoconnect on setting %s",
                   "Enabling" if state else "Disabling",
                   setting.Caption)
    else:
        LOG().info("%s autoconnect on setting %s on device %s",
                   "Enabling" if state else "Disabling",
                   setting.Caption,
                   device.ElementName)

    service = ns.LMI_IPConfigurationService.first_instance()
    if state:
        # Set IsNext = 1 (Is Next), don't change IsCurrent
        mode = service.ApplySettingToIPNetworkConnection.ModeValues.Mode2
    else:
        # Set IsNext = 2 (Is Not Next), don't change IsCurrent
        mode = service.ApplySettingToIPNetworkConnection.ModeValues.Mode5

    if device is None:
        result = service.SyncApplySettingToIPNetworkConnection(SettingData=setting, Mode=mode)
    else:
        result = service.SyncApplySettingToIPNetworkConnection(SettingData=setting, IPNetworkConnection=device, Mode=mode)
    if result.errorstr:
        raise LmiFailed("Unable to change setting autoconnect: %s" % result.errorstr)
    return result.rval
Deleting a post without permissions returns 403.
dataset/ETHPy150Open openlmi/openlmi-scripts/commands/networking/lmi/scripts/networking/__init__.py/set_autoconnect--crossover with--dataset/ETHPy150Open mozilla/kitsune/kitsune/forums/tests/test_views.py/ThreadPermissionsTests.test_post_delete_403