]> git.proxmox.com Git - pve-access-control.git/blobdiff - pveum
bump version to 4.0-5
[pve-access-control.git] / pveum
diff --git a/pveum b/pveum
index 2c468d05cc68f1aa31630739bfbc9dd065aa7761..c9d602e589869300cdd699341689d56e5f6592a2 100755 (executable)
--- 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;
@@ -28,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});
@@ -60,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'] ],
@@ -72,12 +63,27 @@ my $cmddef = {
     rolemod => [ 'PVE::API2::Role', 'update_role', ['roleid'] ],
     roledel => [ 'PVE::API2::Role', 'delete_role', ['roleid'] ],
 
-    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;