mirror of
https://git.proxmox.com/git/pve-common
synced 2025-07-15 09:16:17 +00:00
API schema: add 'allowtoken' property
to mark which API methods should be available to clients authenticated using an API token. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
f82c73738d
commit
4c72ade059
@ -1294,6 +1294,12 @@ my $method_schema = {
|
||||
description => "Method needs special privileges - only pvedaemon can execute it",
|
||||
optional => 1,
|
||||
},
|
||||
allowtoken => {
|
||||
type => 'boolean',
|
||||
description => "Method is available for clients authenticated using an API token.",
|
||||
optional => 1,
|
||||
default => 1,
|
||||
},
|
||||
download => {
|
||||
type => 'boolean',
|
||||
description => "Method downloads the file content (filename is the return value of the method).",
|
||||
|
@ -242,6 +242,9 @@ sub register_method {
|
||||
$errprefix = "register method ${self}/$info->{path} -";
|
||||
$info->{method} = 'GET' if !$info->{method};
|
||||
$method = $info->{method};
|
||||
|
||||
# apply default value
|
||||
$info->{allowtoken} = 1 if !defined($info->{allowtoken});
|
||||
}
|
||||
|
||||
$method_path_lookup->{$self} = {} if !defined($method_path_lookup->{$self});
|
||||
|
Loading…
Reference in New Issue
Block a user