API2/Domains.pm: fix whitespace errors

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-03-06 11:05:39 +01:00 committed by Thomas Lamprecht
parent f28a69a018
commit 32449f358e

View File

@ -16,13 +16,13 @@ my $domainconfigfile = "domains.cfg";
use base qw(PVE::RESTHandler); use base qw(PVE::RESTHandler);
__PACKAGE__->register_method ({ __PACKAGE__->register_method ({
name => 'index', name => 'index',
path => '', path => '',
method => 'GET', method => 'GET',
description => "Authentication domain index.", description => "Authentication domain index.",
permissions => { permissions => {
description => "Anyone can access that, because we need that list for the login box (before the user is authenticated).", description => "Anyone can access that, because we need that list for the login box (before the user is authenticated).",
user => 'world', user => 'world',
}, },
parameters => { parameters => {
additionalProperties => 0, additionalProperties => 0,
@ -51,7 +51,7 @@ __PACKAGE__->register_method ({
}, },
code => sub { code => sub {
my ($param) = @_; my ($param) = @_;
my $res = []; my $res = [];
my $cfg = cfs_read_file($domainconfigfile); my $cfg = cfs_read_file($domainconfigfile);
@ -72,11 +72,11 @@ __PACKAGE__->register_method ({
}}); }});
__PACKAGE__->register_method ({ __PACKAGE__->register_method ({
name => 'create', name => 'create',
protected => 1, protected => 1,
path => '', path => '',
method => 'POST', method => 'POST',
permissions => { permissions => {
check => ['perm', '/access/realm', ['Realm.Allocate']], check => ['perm', '/access/realm', ['Realm.Allocate']],
}, },
description => "Add an authentication server.", description => "Add an authentication server.",
@ -87,14 +87,14 @@ __PACKAGE__->register_method ({
PVE::Auth::Plugin::lock_domain_config( PVE::Auth::Plugin::lock_domain_config(
sub { sub {
my $cfg = cfs_read_file($domainconfigfile); my $cfg = cfs_read_file($domainconfigfile);
my $ids = $cfg->{ids}; my $ids = $cfg->{ids};
my $realm = extract_param($param, 'realm'); my $realm = extract_param($param, 'realm');
my $type = $param->{type}; my $type = $param->{type};
die "domain '$realm' already exists\n" die "domain '$realm' already exists\n"
if $ids->{$realm}; if $ids->{$realm};
die "unable to use reserved name '$realm'\n" die "unable to use reserved name '$realm'\n"
@ -121,10 +121,10 @@ __PACKAGE__->register_method ({
}}); }});
__PACKAGE__->register_method ({ __PACKAGE__->register_method ({
name => 'update', name => 'update',
path => '{realm}', path => '{realm}',
method => 'PUT', method => 'PUT',
permissions => { permissions => {
check => ['perm', '/access/realm', ['Realm.Allocate']], check => ['perm', '/access/realm', ['Realm.Allocate']],
}, },
description => "Update authentication server settings.", description => "Update authentication server settings.",
@ -136,7 +136,7 @@ __PACKAGE__->register_method ({
PVE::Auth::Plugin::lock_domain_config( PVE::Auth::Plugin::lock_domain_config(
sub { sub {
my $cfg = cfs_read_file($domainconfigfile); my $cfg = cfs_read_file($domainconfigfile);
my $ids = $cfg->{ids}; my $ids = $cfg->{ids};
@ -145,7 +145,7 @@ __PACKAGE__->register_method ({
my $realm = extract_param($param, 'realm'); my $realm = extract_param($param, 'realm');
die "domain '$realm' does not exist\n" die "domain '$realm' does not exist\n"
if !$ids->{$realm}; if !$ids->{$realm};
my $delete_str = extract_param($param, 'delete'); my $delete_str = extract_param($param, 'delete');
@ -154,7 +154,7 @@ __PACKAGE__->register_method ({
foreach my $opt (PVE::Tools::split_list($delete_str)) { foreach my $opt (PVE::Tools::split_list($delete_str)) {
delete $ids->{$realm}->{$opt}; delete $ids->{$realm}->{$opt};
} }
my $plugin = PVE::Auth::Plugin->lookup($ids->{$realm}->{type}); my $plugin = PVE::Auth::Plugin->lookup($ids->{$realm}->{type});
my $config = $plugin->check_config($realm, $param, 0, 1); my $config = $plugin->check_config($realm, $param, 0, 1);
@ -176,11 +176,11 @@ __PACKAGE__->register_method ({
# fixme: return format! # fixme: return format!
__PACKAGE__->register_method ({ __PACKAGE__->register_method ({
name => 'read', name => 'read',
path => '{realm}', path => '{realm}',
method => 'GET', method => 'GET',
description => "Get auth server configuration.", description => "Get auth server configuration.",
permissions => { permissions => {
check => ['perm', '/access/realm', ['Realm.Allocate', 'Sys.Audit'], any => 1], check => ['perm', '/access/realm', ['Realm.Allocate', 'Sys.Audit'], any => 1],
}, },
parameters => { parameters => {
@ -196,7 +196,7 @@ __PACKAGE__->register_method ({
my $cfg = cfs_read_file($domainconfigfile); my $cfg = cfs_read_file($domainconfigfile);
my $realm = $param->{realm}; my $realm = $param->{realm};
my $data = $cfg->{ids}->{$realm}; my $data = $cfg->{ids}->{$realm};
die "domain '$realm' does not exist\n" if !$data; die "domain '$realm' does not exist\n" if !$data;
@ -207,10 +207,10 @@ __PACKAGE__->register_method ({
__PACKAGE__->register_method ({ __PACKAGE__->register_method ({
name => 'delete', name => 'delete',
path => '{realm}', path => '{realm}',
method => 'DELETE', method => 'DELETE',
permissions => { permissions => {
check => ['perm', '/access/realm', ['Realm.Allocate']], check => ['perm', '/access/realm', ['Realm.Allocate']],
}, },
description => "Delete an authentication server.", description => "Delete an authentication server.",
@ -232,14 +232,14 @@ __PACKAGE__->register_method ({
my $ids = $cfg->{ids}; my $ids = $cfg->{ids};
my $realm = $param->{realm}; my $realm = $param->{realm};
die "domain '$realm' does not exist\n" if !$ids->{$realm}; die "domain '$realm' does not exist\n" if !$ids->{$realm};
delete $ids->{$realm}; delete $ids->{$realm};
cfs_write_file($domainconfigfile, $cfg); cfs_write_file($domainconfigfile, $cfg);
}, "delete auth server failed"); }, "delete auth server failed");
return undef; return undef;
}}); }});