pve-access-control/test/dump-perm.pl
Fabian Grünbichler 9efcb56129 access-control: remove check_permissions/permission
they have been handled by PVE::RPCEnvironment for quite some time
already, and the versions there are the complete ones that should be
actually used.

manager switched over their last use not long ago, in 6.0-9, so
record a Breaks to that version.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-23 18:12:50 +01:00

39 lines
675 B
Perl
Executable File

#!/usr/bin/perl -w
use strict;
use PVE::RPCEnvironment;
use Getopt::Long;
use Data::Dumper;
# example:
# dump-perm.pl -f myuser.cfg root /
my $opt_file;
if (!GetOptions ("file=s" => \$opt_file)) {
exit (-1);
}
my $username = shift;
my $path = shift;
if (!($username && $path)) {
print "usage: $0 <username> <path>\n";
exit (-1);
}
my $cfg;
my $rpcenv = PVE::RPCEnvironment->init('cli');
if ($opt_file) {
$rpcenv->init_request(userconfig => $opt_file);
} else {
$rpcenv->init_request();
}
my $perm = $rpcenv->permissions($username, $path);
print "permission for user '$username' on '$path':\n";
print join(',', keys %$perm) . "\n";
exit (0);