pvesr: move destroy_job into API class, remove wrong permission checks.

This commit is contained in:
Dietmar Maurer
2017-05-05 11:18:30 +02:00
parent 339ca30a5b
commit 1d3ddfaf2c
2 changed files with 27 additions and 37 deletions

View File

@ -44,9 +44,6 @@ __PACKAGE__->register_method ({
path => 'jobs',
method => 'GET',
description => "List replication jobs.",
permissions => {
user => 'all',
},
protected => 1,
proxyto => 'node',
parameters => {
@ -71,4 +68,28 @@ __PACKAGE__->register_method ({
return PVE::RESTHandler::hash_to_array($jobs, 'vmid');
}});
__PACKAGE__->register_method ({
name => 'destroy_job',
path => 'jobs/vmid',
method => 'DELETE',
description => "Destroy replication job.",
protected => 1,
parameters => {
additionalProperties => 0,
properties => {
vmid => {
description => "The VMID of the guest.",
type => 'string', format => 'pve-vmid',
},
},
},
returns => { type => 'null' },
code => sub {
my ($param) = @_;
PVE::ReplicationTools::destroy_replica($param->{vmid});
return undef;
}});
1;