Exemplo n.º 1
0
def plugin_enable(request, plugin_name):
    # only do this if there isn't a plugin already with the name
    try:
        plugin = Plugin.objects.get(name=plugin_name)
    except Plugin.DoesNotExist:
        plugin = Plugin(name=plugin_name, order=utils.unique_plugin_order())
        plugin.save()
    return redirect('plugins_page')
Exemplo n.º 2
0
def plugin_enable(request, plugin_name):
    # only do this if there isn't a plugin already with the name
    try:
        plugin = Plugin.objects.get(name=plugin_name)
    except Plugin.DoesNotExist:
        plugin = Plugin(name=plugin_name, order=utils.unique_plugin_order())
        plugin.save()
    return redirect('plugins_page')
Exemplo n.º 3
0
def machine_detail_plugin_enable(request, plugin_name):
    # only do this if there isn't a plugin already with the name
    try:
        _ = MachineDetailPlugin.objects.get(name=plugin_name)
    except MachineDetailPlugin.DoesNotExist:
        plugin = sal.plugin.PluginManager.get_plugin_by_name(plugin_name)
        if plugin:
            db_plugin = MachineDetailPlugin(
                name=plugin_name,
                order=utils.unique_plugin_order(plugin_type='machine_detail'))
            db_plugin.save()
    return redirect('settings_machine_detail_plugins')
Exemplo n.º 4
0
def enable_plugins(apps, schema_editor):

    Machine = apps.get_model("server", "Machine")

    Plugin = apps.get_model("server", "Plugin")
    new_plugins = ['Encryption', 'Gatekeeper', 'Sip', 'XprotectVersion']
    if Plugin.objects.count() != 0:
        for plugin_name in new_plugins:
            try:
                plugin = Plugin.objects.get(name=plugin_name)
            except Plugin.DoesNotExist:
                plugin = Plugin(name=plugin_name, order=utils.unique_plugin_order())
                plugin.save()
Exemplo n.º 5
0
def machine_detail_plugin_enable(request, plugin_name):
    # only do this if there isn't a plugin already with the name
    try:
        plugin = MachineDetailPlugin.objects.get(name=plugin_name)
    except MachineDetailPlugin.DoesNotExist:
        enabled_plugins = MachineDetailPlugin.objects.all()  # noqa: F841
        manager = sal.plugin.PluginManager()

        plugin = manager.get_plugin_by_name(plugin_name)
        if plugin:
            db_plugin = MachineDetailPlugin(
                name=plugin_name, order=utils.unique_plugin_order(plugin_type='machine_detail'))
            db_plugin.save()
    return redirect('settings_machine_detail_plugins')