From: Dietmar Maurer Date: Wed, 30 May 2012 06:47:43 +0000 (+0200) Subject: correctly compute GUI capabilities (consider pools) X-Git-Url: https://git.proxmox.com/?p=pve-access-control.git;a=commitdiff_plain;h=437be042c2497a1956b359bb9e2797f838a37340 correctly compute GUI capabilities (consider pools) --- diff --git a/Makefile b/Makefile index 04bc297..bbea6a9 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ RELEASE=2.1 VERSION=1.0 PACKAGE=libpve-access-control -PKGREL=22 +PKGREL=23 DESTDIR= PREFIX=/usr diff --git a/PVE/API2/AccessControl.pm b/PVE/API2/AccessControl.pm index 141bc44..1679ed4 100644 --- a/PVE/API2/AccessControl.pm +++ b/PVE/API2/AccessControl.pm @@ -151,12 +151,22 @@ my $compute_api_permission = sub { dc => {}, }; - foreach my $vmid (keys %$idlist, '__phantom__') { - my $perm = $rpcenv->permissions($authuser, "/vms/$vmid"); + my $extract_vm_caps = sub { + my ($path) = @_; + + my $perm = $rpcenv->permissions($authuser, $path); foreach my $priv (keys %$perm) { - next if !($priv eq 'Permissions.Modify' ||$priv =~ m/^VM\./); + next if !($priv eq 'Permissions.Modify' || $priv =~ m/^VM\./); $res->{vms}->{$priv} = 1; } + }; + + foreach my $pool (keys %{$usercfg->{pools}}) { + &$extract_vm_caps("/pool/$pool"); + } + + foreach my $vmid (keys %$idlist, '__phantom__') { + &$extract_vm_caps("/vms/$vmid"); } foreach my $storeid (@sids, '__phantom__') { diff --git a/changelog.Debian b/changelog.Debian index d48eba0..6d442f3 100644 --- a/changelog.Debian +++ b/changelog.Debian @@ -1,3 +1,9 @@ +libpve-access-control (1.0-23) unstable; urgency=low + + * correctly compute GUI capabilities (consider pools) + + -- Proxmox Support Team Wed, 30 May 2012 08:47:23 +0200 + libpve-access-control (1.0-22) unstable; urgency=low * new plugin architecture for Auth modules, minor API change for Auth