mirror of
https://git.proxmox.com/git/pve-access-control
synced 2025-08-15 07:43:37 +00:00
allow to pass emtpy strings to delete settings
This commit is contained in:
parent
af4a8a8522
commit
0c1563637a
@ -146,12 +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
|
||||
if (defined($param->{port}) && !$param->{port}) {
|
||||
delete $cfg->{$realm}->{port};
|
||||
# server2 == '' ===> delete server2
|
||||
for my $p (qw(port server2)) {
|
||||
if (defined($param->{$p}) && !$param->{$p}) {
|
||||
delete $cfg->{$realm}->{$p};
|
||||
}
|
||||
}
|
||||
|
||||
cfs_write_file($domainconfigfile, $cfg);
|
||||
@ -247,12 +250,11 @@ __PACKAGE__->register_method ({
|
||||
}
|
||||
|
||||
foreach my $p (keys %$param) {
|
||||
if ($param->{$p}) {
|
||||
$cfg->{$realm}->{$p} = $param->{$p};
|
||||
} else {
|
||||
delete $cfg->{$realm}->{$p};
|
||||
}
|
||||
|
||||
# port 0 ==> use default
|
||||
if (defined($param->{port}) && !$param->{port}) {
|
||||
delete $cfg->{$realm}->{port};
|
||||
}
|
||||
|
||||
cfs_write_file($domainconfigfile, $cfg);
|
||||
|
@ -899,7 +899,7 @@ sub write_domains {
|
||||
$wrote_default = 1;
|
||||
} elsif (defined($formats->{$k})) {
|
||||
if (!$formats->{$k}) {
|
||||
$data .= "\t$k\n";
|
||||
$data .= "\t$k\n" if $v;
|
||||
} elsif ($v =~ m/^$formats->{$k}$/) {
|
||||
$v = PVE::Tools::encode_text($v) if $k eq 'comment';
|
||||
$data .= "\t$k $v\n";
|
||||
@ -994,6 +994,8 @@ sub parse_domains {
|
||||
warn "ignoring domain '$realm' - missing user attribute\n";
|
||||
} elsif (($entry->{type} eq "ldap") && !$entry->{base_dn}) {
|
||||
warn "ignoring domain '$realm' - missing base_dn attribute\n";
|
||||
} elsif (($entry->{type} eq "ad") && !$entry->{domain}) {
|
||||
warn "ignoring domain '$realm' - missing domain attribute\n";
|
||||
} else {
|
||||
$cfg->{$realm} = $entry;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user