[pve-devel] [PATCH] use vm create permissions for templates

Stefan Priebe s.priebe at profihost.ag
Fri Apr 19 08:37:32 CEST 2013


Signed-off-by: Stefan Priebe <s.priebe at profihost.ag>
---
 PVE/API2/Qemu.pm |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index b835575..b245257 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2632,6 +2632,13 @@ __PACKAGE__->register_method({
     protected => 1,
     proxyto => 'node',
     description => "Create a Template.",
+    permissions => {
+	description => "You need 'VM.Allocate' permissions on /vms/{vmid} or on the VM pool /pool/{pool}. If you create disks you need 'Datastore.AllocateSpace' on any used storage.",
+	check => [ 'or', 
+		   [ 'perm', '/vms/{vmid}', ['VM.Allocate']],
+		   [ 'perm', '/pool/{pool}', ['VM.Allocate'], require_param => 'pool'],
+	    ],
+    },
     parameters => {
 	additionalProperties => 0,
 	properties => {
-- 
1.7.10.4




More information about the pve-devel mailing list