[pve-devel] [PATCH 19/23] subscription: use rpcenv for permission check

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Oct 17 15:14:14 CEST 2019


this is the last caller of PVE::AccessControl::check_permissions(),
which is the last caller of PVE::AccessControl::permission(). both can
thus be dropped altogether.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---

Notes:
    this is semi-independent, but if applied we need to remember that the
    corresponding patch in pve-access-control needs to break on pve-manager with
    the right version

 PVE/API2/Subscription.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/Subscription.pm b/PVE/API2/Subscription.pm
index 2c0c4e84..959c2c1b 100644
--- a/PVE/API2/Subscription.pm
+++ b/PVE/API2/Subscription.pm
@@ -108,7 +108,7 @@ __PACKAGE__->register_method ({
 
 	my $rpcenv = PVE::RPCEnvironment::get();
 	my $authuser = $rpcenv->get_user();
-	my $has_permission = PVE::AccessControl::check_permissions($authuser, "/nodes/$node", 'Sys.Audit');
+	my $has_permission = $rpcenv->check($authuser, "/nodes/$node", ['Sys.Audit'], 1);
 
 	my $server_id = PVE::API2Tools::get_hwaddress();
 	my $url = "https://www.proxmox.com/proxmox-ve/pricing";
-- 
2.20.1





More information about the pve-devel mailing list