-use Data::Dumper; # fixme: remove
-
-$ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
-
-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});
-
- my $term = new Term::ReadLine ('pveum');
- my $attribs = $term->Attribs;
- $attribs->{redisplay_function} = $attribs->{shadow_redisplay};
- my $input = $term->readline('Enter new password: ');
- my $conf = $term->readline('Retype new password: ');
- die "Passwords do not match.\n" if ($input ne $conf);
- return $input;
-};
-
-my $cmddef = {
- ticket => [ 'PVE::API2::AccessControl', 'create_ticket', ['username'], undef,
- sub {
- my ($res) = @_;
- print "$res->{ticket}\n";
- }],
- useradd => [ 'PVE::API2::User', 'create_user', ['userid'] ],
- usermod => [ 'PVE::API2::User', 'update_user', ['userid'] ],
- userdel => [ 'PVE::API2::User', 'delete_user', ['userid'] ],
-
- groupadd => [ 'PVE::API2::Group', 'create_group', ['groupid'] ],
- groupmod => [ 'PVE::API2::Group', 'update_group', ['groupid'] ],
- groupdel => [ 'PVE::API2::Group', 'delete_group', ['groupid'] ],
-
- roleadd => [ 'PVE::API2::Role', 'create_role', ['roleid'] ],
- 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 }],