[pve-devel] [PATCH access-control v5 5/5] pveum: add list and dump commands

Stoiko Ivanov s.ivanov at proxmox.com
Thu Jun 21 14:31:47 CEST 2018


* Adds list for all objects currently handled in the CLI
* Adds dump for User and Group
* Uses print_api_list and print_entry from PVE::CLIHandler

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 PVE/CLI/pveum.pm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/PVE/CLI/pveum.pm b/PVE/CLI/pveum.pm
index b8412eb..a6dbf36 100755
--- a/PVE/CLI/pveum.pm
+++ b/PVE/CLI/pveum.pm
@@ -42,20 +42,40 @@ our $cmddef = {
 	add    => [ 'PVE::API2::User', 'create_user', ['userid'] ],
 	modify => [ 'PVE::API2::User', 'update_user', ['userid'] ],
 	delete => [ 'PVE::API2::User', 'delete_user', ['userid'] ],
+	list   => [ 'PVE::API2::User', 'index', [], {}, sub {
+	    my ($data, $returnprops) = @_;
+	    PVE::CLIHandler::print_api_list( [ 'userid', 'enable' ], $data, $returnprops);
+	    } ],
+	dump   => [ 'PVE::API2::User', 'read_user', ['userid'], undef, sub {
+	    PVE::CLIHandler::print_entry(shift) } ],
     },
     group => {
 	add    => [ 'PVE::API2::Group', 'create_group', ['groupid'] ],
 	modify => [ 'PVE::API2::Group', 'update_group', ['groupid'] ],
 	delete => [ 'PVE::API2::Group', 'delete_group', ['groupid'] ],
+	list   => [ 'PVE::API2::Group', 'index', [], {}, sub {
+	    my ($data, $returnprops) = @_;
+	    PVE::CLIHandler::print_api_list( [ 'groupid'], $data, $returnprops);
+	} ],
+	dump   => [ 'PVE::API2::Group', 'read_group', ['groupid'], undef, sub {
+	    PVE::CLIHandler::print_entry(shift) } ],
     },
     role => {
 	add    => [ 'PVE::API2::Role', 'create_role', ['roleid'] ],
 	modify => [ 'PVE::API2::Role', 'update_role', ['roleid'] ],
 	delete => [ 'PVE::API2::Role', 'delete_role', ['roleid'] ],
+	list   => [ 'PVE::API2::Role', 'index', [], {}, sub {
+	    my ($data, $returnprops) = @_;
+	    PVE::CLIHandler::print_api_list( [ 'roleid', 'special', 'privs'], $data, $returnprops);
+	} ],
     },
     acl => {
 	modify => [ 'PVE::API2::ACL', 'update_acl', ['path'], { delete => 0 }],
 	delete => [ 'PVE::API2::ACL', 'update_acl', ['path'], { delete => 1 }],
+	list   => [ 'PVE::API2::ACL', 'read_acl', [], {}, sub {
+	    my ($data, $returnprops) = @_;
+	    PVE::CLIHandler::print_api_list( [ 'ugid', 'roleid', 'propagate', 'path'], $data, $returnprops);
+	} ],
     },
     ticket => [ 'PVE::API2::AccessControl', 'create_ticket', ['username'], undef,
 		sub {
-- 
2.11.0





More information about the pve-devel mailing list