]> git.proxmox.com Git - pve-access-control.git/blame - PVE/CLI/pveum.pm
user.cfg: sort group and pool members, role privs
[pve-access-control.git] / PVE / CLI / pveum.pm
CommitLineData
09281ad7
DM
1package PVE::CLI::pveum;
2
3use strict;
4use warnings;
042eaa3d 5
09281ad7
DM
6use PVE::RPCEnvironment;
7use PVE::API2::User;
8use PVE::API2::Group;
9use PVE::API2::Role;
10use PVE::API2::ACL;
11use PVE::API2::AccessControl;
09281ad7 12use PVE::CLIHandler;
b34d76e7 13use PVE::PTY;
09281ad7
DM
14
15use base qw(PVE::CLIHandler);
16
e623414a
DM
17sub setup_environment {
18 PVE::RPCEnvironment->setup_default_cli_env();
19}
20
b34d76e7
DC
21sub param_mapping {
22 my ($name) = @_;
98007830 23
b34d76e7
DC
24 my $mapping = {
25 'change_password' => [
26 PVE::CLIHandler::get_standard_mapping('pve-password'),
27 ],
28 'create_ticket' => [
29 PVE::CLIHandler::get_standard_mapping('pve-password', {
30 func => sub {
31 # do not accept values given on cmdline
32 return PVE::PTY::read_password('Enter password: ');
33 },
34 }),
35 ]
36 };
37
38 return $mapping->{$name};
98007830
DM
39}
40
09281ad7 41our $cmddef = {
1e41cdc9
PA
42 user => {
43 add => [ 'PVE::API2::User', 'create_user', ['userid'] ],
44 modify => [ 'PVE::API2::User', 'update_user', ['userid'] ],
45 delete => [ 'PVE::API2::User', 'delete_user', ['userid'] ],
46 },
47 group => {
48 add => [ 'PVE::API2::Group', 'create_group', ['groupid'] ],
49 modify => [ 'PVE::API2::Group', 'update_group', ['groupid'] ],
50 delete => [ 'PVE::API2::Group', 'delete_group', ['groupid'] ],
51 },
52 role => {
53 add => [ 'PVE::API2::Role', 'create_role', ['roleid'] ],
54 modify => [ 'PVE::API2::Role', 'update_role', ['roleid'] ],
55 delete => [ 'PVE::API2::Role', 'delete_role', ['roleid'] ],
56 },
57 acl => {
58 modify => [ 'PVE::API2::ACL', 'update_acl', ['path'], { delete => 0 }],
59 delete => [ 'PVE::API2::ACL', 'update_acl', ['path'], { delete => 1 }],
60 },
09281ad7
DM
61 ticket => [ 'PVE::API2::AccessControl', 'create_ticket', ['username'], undef,
62 sub {
63 my ($res) = @_;
64 print "$res->{ticket}\n";
65 }],
66
765305e2 67 passwd => [ 'PVE::API2::AccessControl', 'change_password', ['userid'] ],
09281ad7 68
1e41cdc9
PA
69 useradd => { alias => 'user add' },
70 usermod => { alias => 'user modify' },
71 userdel => { alias => 'user delete' },
09281ad7 72
1e41cdc9
PA
73 groupadd => { alias => 'group add' },
74 groupmod => { alias => 'group modify' },
75 groupdel => { alias => 'group delete' },
09281ad7 76
1e41cdc9
PA
77 roleadd => { alias => 'role add' },
78 rolemod => { alias => 'role modify' },
79 roledel => { alias => 'role delete' },
09281ad7 80
1e41cdc9
PA
81 aclmod => { alias => 'acl modify' },
82 acldel => { alias => 'acl delete' },
09281ad7
DM
83};
84
851;