X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=pveum;h=c9d602e589869300cdd699341689d56e5f6592a2;hb=d6eb66211950cf1f9d6cc832a4dfe74a91443fe8;hp=9214d1f9d69e02efc3e484218c6626c47eba90b7;hpb=39c85db819dc564e89270f6f6d15dbce79d0540b;p=pve-access-control.git diff --git a/pveum b/pveum index 9214d1f..c9d602e 100755 --- a/pveum +++ b/pveum @@ -1,6 +1,7 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; use Getopt::Long; use PVE::Tools qw(run_command); use PVE::Cluster; @@ -14,7 +15,6 @@ use PVE::API2::User; use PVE::API2::Group; use PVE::API2::Role; use PVE::API2::ACL; -use PVE::API2::Pool; use PVE::API2::AccessControl; use PVE::JSONSchema qw(get_standard_option); use PVE::CLIHandler; @@ -29,19 +29,6 @@ initlog('pveum'); #fixme: logging? -die "please run as root\n" if $> != 0; - -PVE::INotify::inotify_init(); - -my $rpcenv = PVE::RPCEnvironment->init('cli'); - -$rpcenv->init_request(); -$rpcenv->set_language($ENV{LANG}); -$rpcenv->set_user('root@pam'); - -# autmatically generate the private key if it does not already exists -PVE::Cluster::gen_auth_key(); - my $read_password = sub { # return $ENV{PVE_PW_TICKET} if defined($ENV{PVE_PW_TICKET}); @@ -61,6 +48,9 @@ my $cmddef = { my ($res) = @_; print "$res->{ticket}\n"; }], + + passwd => [ 'PVE::API2::AccessControl', 'change_passsword', ['userid'] ], + useradd => [ 'PVE::API2::User', 'create_user', ['userid'] ], usermod => [ 'PVE::API2::User', 'update_user', ['userid'] ], userdel => [ 'PVE::API2::User', 'delete_user', ['userid'] ], @@ -73,16 +63,27 @@ my $cmddef = { rolemod => [ 'PVE::API2::Role', 'update_role', ['roleid'] ], roledel => [ 'PVE::API2::Role', 'delete_role', ['roleid'] ], - pooladd => [ 'PVE::API2::Pool', 'create_pool', ['poolid'] ], - poolmod => [ 'PVE::API2::Pool', 'update_pool', ['poolid'] ], - pooldel => [ 'PVE::API2::Pool', 'delete_pool', ['poolid'] ], - - aclmod => [ 'PVE::API2::ACL', 'update_acl', ['path', 'roles'], { delete => 0 }], - acldel => [ 'PVE::API2::ACL', 'update_acl', ['path', 'roles'], { delete => 1 }], + aclmod => [ 'PVE::API2::ACL', 'update_acl', ['path'], { delete => 0 }], + acldel => [ 'PVE::API2::ACL', 'update_acl', ['path'], { delete => 1 }], }; my $cmd = shift; +if (defined($cmd) && $cmd ne 'verifyapi' && $cmd ne 'printmanpod') { + die "please run as root\n" if $> != 0; + + PVE::INotify::inotify_init(); + + my $rpcenv = PVE::RPCEnvironment->init('cli'); + + $rpcenv->init_request(); + $rpcenv->set_language($ENV{LANG}); + $rpcenv->set_user('root@pam'); + +# autmatically generate the private key if it does not already exists + PVE::Cluster::gen_auth_key(); +} + PVE::CLIHandler::handle_cmd($cmddef, "pveum", $cmd, \@ARGV, $read_password, $0); exit 0;