]> git.proxmox.com Git - pve-access-control.git/blame - test/dump-perm.pl
d/control: bump debhelper compat to >= 12
[pve-access-control.git] / test / dump-perm.pl
CommitLineData
2c3a6c0a
DM
1#!/usr/bin/perl -w
2
3use strict;
9efcb561 4use PVE::RPCEnvironment;
2c3a6c0a
DM
5use Getopt::Long;
6use Data::Dumper;
7
8# example:
9# dump-perm.pl -f myuser.cfg root /
10
11my $opt_file;
12if (!GetOptions ("file=s" => \$opt_file)) {
13 exit (-1);
14}
15
16my $username = shift;
17my $path = shift;
18
19if (!($username && $path)) {
20 print "usage: $0 <username> <path>\n";
21 exit (-1);
22}
23
24my $cfg;
25
9efcb561 26my $rpcenv = PVE::RPCEnvironment->init('cli');
2c3a6c0a 27if ($opt_file) {
9efcb561 28 $rpcenv->init_request(userconfig => $opt_file);
2c3a6c0a 29} else {
9efcb561 30 $rpcenv->init_request();
2c3a6c0a 31}
9efcb561
FG
32
33my $perm = $rpcenv->permissions($username, $path);
2c3a6c0a
DM
34
35print "permission for user '$username' on '$path':\n";
36print join(',', keys %$perm) . "\n";
37
38exit (0);