[pve-devel] [PATCH access-control v5 4/5] Add title and print_width fields to properties

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


Used for printing in pveum

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 PVE/API2/ACL.pm    | 8 +++++---
 PVE/API2/Group.pm  | 1 +
 PVE/API2/Role.pm   | 6 ++++--
 PVE/API2/User.pm   | 1 +
 PVE/Auth/Plugin.pm | 2 +-
 5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/PVE/API2/ACL.pm b/PVE/API2/ACL.pm
index 3e42ac0..866e023 100644
--- a/PVE/API2/ACL.pm
+++ b/PVE/API2/ACL.pm
@@ -17,11 +17,13 @@ use base qw(PVE::RESTHandler);
 register_standard_option('acl-propagate', {
     description => "Allow to propagate (inherit) permissions.",
     type => 'boolean',
+    title => 'Propagate',
     optional => 1,
     default => 1,
 });
 register_standard_option('acl-path', {
     description => "Access control path",
+    title => 'Path',
     type => 'string',
 });
 
@@ -46,9 +48,9 @@ __PACKAGE__->register_method ({
 	    properties => {
 		propagate => get_standard_option('acl-propagate'),
 		path => get_standard_option('acl-path'),
-		type => { type => 'string', enum => ['user', 'group'] },
-		ugid => { type => 'string' },
-		roleid => { type => 'string' },
+		type => { type => 'string', title => 'Type', enum => ['user', 'group'] },
+		ugid => { type => 'string', title => 'ID' },
+		roleid => { type => 'string', title => 'Role' },
 	    },
 	},
     },
diff --git a/PVE/API2/Group.pm b/PVE/API2/Group.pm
index 37f8be2..1d6ba98 100644
--- a/PVE/API2/Group.pm
+++ b/PVE/API2/Group.pm
@@ -13,6 +13,7 @@ use base qw(PVE::RESTHandler);
 register_standard_option('group-id', {
     type => 'string',
     format => 'pve-groupid',
+    title => 'Group ID' ,
     completion => \&PVE::AccessControl::complete_group,
 });
 
diff --git a/PVE/API2/Role.pm b/PVE/API2/Role.pm
index 80959b0..156d3b8 100644
--- a/PVE/API2/Role.pm
+++ b/PVE/API2/Role.pm
@@ -15,11 +15,13 @@ use base qw(PVE::RESTHandler);
 register_standard_option('role-id', {
     type => 'string',
     format => 'pve-roleid',
+    title => 'Role ID',
+    print_width => 30
 });
 register_standard_option('role-privs', {
     type => 'string' ,
     format => 'pve-priv-list',
-    optional => 1,
+    optional => 1, title => 'Privileges',
 });
 
 __PACKAGE__->register_method ({
@@ -41,7 +43,7 @@ __PACKAGE__->register_method ({
 	    properties => {
 		roleid => get_standard_option('role-id'),
 		privs =>  get_standard_option('role-privs'),
-		special => { type => 'boolean', optional => 1, default => 0 },
+		special => { type => 'boolean', optional => 1, default => 0, title => 'Built-In' },
 	    },
 	},
 	links => [ { rel => 'child', href => "{roleid}" } ],
diff --git a/PVE/API2/User.pm b/PVE/API2/User.pm
index 4c859dc..89c8343 100644
--- a/PVE/API2/User.pm
+++ b/PVE/API2/User.pm
@@ -15,6 +15,7 @@ use PVE::RESTHandler;
 use base qw(PVE::RESTHandler);
 
 register_standard_option('user-enable', {
+    title => "Enable",
     description => "Enable the account (default). You can set this to '0' to disable the account",
     type => 'boolean',
     optional => 1,
diff --git a/PVE/Auth/Plugin.pm b/PVE/Auth/Plugin.pm
index d5d2c06..0bffa2b 100755
--- a/PVE/Auth/Plugin.pm
+++ b/PVE/Auth/Plugin.pm
@@ -76,7 +76,7 @@ sub verify_username {
 }
 
 PVE::JSONSchema::register_standard_option('userid', {
-    description => "User ID",
+    description => "User ID", title => "User ID",
     type => 'string', format => 'pve-userid',
     maxLength => 64,
 });
-- 
2.11.0





More information about the pve-devel mailing list