[pve-devel] [PATCH access-control v6] pveum: add list and dump commands

Stoiko Ivanov s.ivanov at proxmox.com
Tue Jun 26 11:48:01 CEST 2018


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

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
Changes from v5:
* adapt to the new methods in pve-common - supersedes only the last commit in
  the series.
PVE/CLI/pveum.pm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/PVE/CLI/pveum.pm b/PVE/CLI/pveum.pm
index b8412eb..42531c0 100755
--- a/PVE/CLI/pveum.pm
+++ b/PVE/CLI/pveum.pm
@@ -42,20 +42,42 @@ 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, $result_schema) = @_;
+	    PVE::CLIHandler::print_api_list($data, $result_schema,  [ 'userid', 'enable' ] );
+	    } ],
+	dump   => [ 'PVE::API2::User', 'read_user', ['userid'], undef, sub {
+	    my ($data, $result_schema) = @_;
+	    PVE::CLIHandler::print_api_result('text', $data, $result_schema) } ],
     },
     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, $result_schema) = @_;
+	    PVE::CLIHandler::print_api_list($data, $result_schema,  [ 'groupid'] );
+	} ],
+	dump   => [ 'PVE::API2::Group', 'read_group', ['groupid'], undef, sub {
+	    my ($data, $result_schema) = @_;
+	    PVE::CLIHandler::print_api_result('text', $data, $result_schema) } ],
     },
     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, $result_schema) = @_;
+	    PVE::CLIHandler::print_api_list( $data, $result_schema, [ 'roleid', 'special', 'privs' ] );
+	} ],
     },
     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, $result_schema) = @_;
+	    PVE::CLIHandler::print_api_list( $data, $result_schema, [ 'ugid', 'roleid', 'propagate', 'path' ] );
+	} ],
     },
     ticket => [ 'PVE::API2::AccessControl', 'create_ticket', ['username'], undef,
 		sub {
-- 
2.11.0





More information about the pve-devel mailing list