[pmg-devel] [PATCH pmg-api 2/3] add 'quarantinelink' to admin config

Stoiko Ivanov s.ivanov at proxmox.com
Tue Nov 17 14:20:06 CET 2020


On Tue, 17 Nov 2020 09:05:11 +0100
Dominik Csapak <d.csapak at proxmox.com> wrote:

> to enable the 'Request Quarantine Link' button and api call
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  src/PMG/Config.pm           | 6 ++++++
>  src/PMG/Service/pmgproxy.pm | 4 ++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
> index cd69c9c..c7e2aca 100755
> --- a/src/PMG/Config.pm
> +++ b/src/PMG/Config.pm
> @@ -126,6 +126,11 @@ sub properties {
>  	    description => "Default DKIM selector",
>  	    type => 'string', format => 'dns-name', #see RFC6376 3.1
>  	},
> +	quarantinelink => {
> +	    description => "Enables user self-service for Quarantine Links. Caution: this is accessible without authentication",
> +	    type => 'boolean',
> +	    default => 0,
> +	},
>      };
>  }
>  
> @@ -144,6 +149,7 @@ sub options {
>  	dkim_sign => { optional => 1 },
>  	dkim_sign_all_mail => { optional => 1 },
>  	dkim_selector => { optional => 1 },
> +	quarantinelink => { optional => 1 },
>      };
>  }
>  
> diff --git a/src/PMG/Service/pmgproxy.pm b/src/PMG/Service/pmgproxy.pm
> index ea58b50..6d51048 100755
> --- a/src/PMG/Service/pmgproxy.pm
> +++ b/src/PMG/Service/pmgproxy.pm
> @@ -21,6 +21,7 @@ use PVE::APIServer::Utils;
>  
>  use PMG::HTTPServer;
>  use PMG::API2;
> +use PMG::Config;
>  
>  use Template;
>  
> @@ -227,6 +228,8 @@ sub get_index {
>  	$version = $1;
>      };
>  
> +    my $cfg = PMG::Config->new();
> +    my $quarantinelink = $cfg->get('admin', 'quarantinelink');
>  
>      $username = '' if !$username;
>  
> @@ -242,6 +245,7 @@ sub get_index {
>  	debug => $args->{debug} || $server->{debug},
>  	version => $version,
>  	wtversion => $wtversion,
> +	quarantinelink => $quarantinelink,
>      };
>  
>      my $template_name;
nit: I would probably put the change to pmgproxy in the next patch (where
it actually  gets used in the index.html.tt template




More information about the pmg-devel mailing list