]> git.proxmox.com Git - pve-access-control.git/blobdiff - PVE/API2/Domains.pm
use new syntax for permission checks
[pve-access-control.git] / PVE / API2 / Domains.pm
index 26223d3a2a1d8a722efcb1c963ccf7e44a4a3990..c79e44e0f033a1cbc08a645efabe029677ef9812 100644 (file)
@@ -94,12 +94,17 @@ __PACKAGE__->register_method ({
                optional => 1,
            },
            port => {
-               description => "Server port",
+               description => "Server port. Use '0' if you want to use default settings'",
                type => 'integer',
-               minimum => 1,
+               minimum => 0,
                maximum => 65535,
                optional => 1,
            },
+           domain => {
+               description => "AD domain name",
+               type => 'string',
+               optional => 1,
+           },
            base_dn => {
                description => "LDAP base domain name",
                type => 'string',
@@ -132,7 +137,7 @@ __PACKAGE__->register_method ({
                if (defined($param->{secure})) {
                    $cfg->{$realm}->{secure} = $param->{secure} ? 1 : 0;
                }
-       
+
                if ($param->{default}) {
                    foreach my $r (keys %$cfg) {
                        delete $cfg->{$r}->{default};
@@ -141,7 +146,15 @@ __PACKAGE__->register_method ({
 
                foreach my $p (keys %$param) {
                    next if $p eq 'realm';
-                   $cfg->{$realm}->{$p} = $param->{$p};
+                   $cfg->{$realm}->{$p} = $param->{$p} if $param->{$p};
+               }
+
+               # port 0 ==> use default
+               # server2 == '' ===> delete server2
+               for my $p (qw(port server2)) { 
+                   if (defined($param->{$p}) && !$param->{$p}) { 
+                       delete $cfg->{$realm}->{$p};
+                   }
                }
 
                cfs_write_file($domainconfigfile, $cfg);
@@ -185,12 +198,17 @@ __PACKAGE__->register_method ({
                optional => 1,
            },
            port => {
-               description => "Server port",
+               description => "Server port. Use '0' if you want to use default settings'",
                type => 'integer',
-               minimum => 1,
+               minimum => 0,
                maximum => 65535,
                optional => 1,
            },
+           domain => {
+               description => "AD domain name",
+               type => 'string',
+               optional => 1,
+           },
            base_dn => {
                description => "LDAP base domain name",
                type => 'string',
@@ -232,7 +250,11 @@ __PACKAGE__->register_method ({
                }
 
                foreach my $p (keys %$param) {
-                   $cfg->{$realm}->{$p} = $param->{$p};
+                   if ($param->{$p}) {
+                       $cfg->{$realm}->{$p} = $param->{$p};
+                   } else {
+                       delete $cfg->{$realm}->{$p};
+                   }
                }
 
                cfs_write_file($domainconfigfile, $cfg);