]> git.proxmox.com Git - pve-manager.git/commitdiff
api: subscription: use rpcenv for permission check
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 17 Oct 2019 13:14:14 +0000 (15:14 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 17 Oct 2019 14:53:57 +0000 (16:53 +0200)
commit 2d2ed7ab5305eb4b5875e7d0888011edc4ad32f7 had a valid cause but
unnecessarily used the static PVE::AccessControl::check_permissions.
As the RPCEnvironment based check method has a "$noerr" parameter and
we already have a rpcenv instance readily available, we can use that
one just fine.

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@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/API2/Subscription.pm

index 2c0c4e841dce6e034a5796af98d3fcfbd8acb36d..959c2c1b6e06fc2e78a33cb76df5e1a36b93e102 100644 (file)
@@ -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";