From 742a7b6cbd2f1052ca5f5f1fc2a6a62a7d95310e Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 19 Feb 2024 15:12:22 +0100 Subject: [PATCH] tests: split long expected-permission list over multiple lines for a better overview and to allow slightly easier tracking of any change, like adding a new privilege. Signed-off-by: Thomas Lamprecht --- src/test/perm-test1.pl | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/test/perm-test1.pl b/src/test/perm-test1.pl index a9dc502..27aadeb 100755 --- a/src/test/perm-test1.pl +++ b/src/test/perm-test1.pl @@ -59,9 +59,32 @@ check_permission('alex@pve', '/vms', ''); check_permission('alex@pve', '/vms/100', 'VM.Audit,VM.PowerMgmt'); # PVEVMAdmin -> no Permissions.Modify! -check_permission('alex@pve', '/vms/300', 'VM.Allocate,VM.Audit,VM.Backup,VM.Clone,VM.Config.CDROM,VM.Config.CPU,VM.Config.Cloudinit,VM.Config.Disk,VM.Config.HWType,VM.Config.Memory,VM.Config.Network,VM.Config.Options,VM.Console,VM.Migrate,VM.Monitor,VM.PowerMgmt,VM.Snapshot,VM.Snapshot.Rollback'); +check_permission( + 'alex@pve', + '/vms/300', + '' # sorted, comma-separated expected privilege string + . 'VM.Allocate,VM.Audit,VM.Backup,VM.Clone,VM.Config.CDROM,VM.Config.CPU,VM.Config.Cloudinit,' + . 'VM.Config.Disk,VM.Config.HWType,VM.Config.Memory,VM.Config.Network,VM.Config.Options,' + . 'VM.Console,VM.Migrate,VM.Monitor,VM.PowerMgmt,VM.Snapshot,VM.Snapshot.Rollback' +); # Administrator -> Permissions.Modify! -check_permission('alex@pve', '/vms/400', 'Datastore.Allocate,Datastore.AllocateSpace,Datastore.AllocateTemplate,Datastore.Audit,Group.Allocate,Mapping.Audit,Mapping.Modify,Mapping.Use,Permissions.Modify,Pool.Allocate,Pool.Audit,Realm.Allocate,Realm.AllocateUser,SDN.Allocate,SDN.Audit,SDN.Use,Sys.Audit,Sys.Console,Sys.Incoming,Sys.Modify,Sys.PowerMgmt,Sys.Syslog,User.Modify,VM.Allocate,VM.Audit,VM.Backup,VM.Clone,VM.Config.CDROM,VM.Config.CPU,VM.Config.Cloudinit,VM.Config.Disk,VM.Config.HWType,VM.Config.Memory,VM.Config.Network,VM.Config.Options,VM.Console,VM.Migrate,VM.Monitor,VM.PowerMgmt,VM.Snapshot,VM.Snapshot.Rollback'); +check_permission( + 'alex@pve', + '/vms/400', + '' # sorted, comma-separated expected privilege string, loosely grouped by prefix + . 'Datastore.Allocate,Datastore.AllocateSpace,Datastore.AllocateTemplate,Datastore.Audit,' + . 'Group.Allocate,' + . 'Mapping.Audit,Mapping.Modify,Mapping.Use,' + . 'Permissions.Modify,' + . 'Pool.Allocate,Pool.Audit,' + . 'Realm.Allocate,Realm.AllocateUser,' + . 'SDN.Allocate,SDN.Audit,SDN.Use,' + . 'Sys.Audit,Sys.Console,Sys.Incoming,Sys.Modify,Sys.PowerMgmt,Sys.Syslog,' + . 'User.Modify,' + . 'VM.Allocate,VM.Audit,VM.Backup,VM.Clone,VM.Config.CDROM,VM.Config.CPU,VM.Config.Cloudinit,' + . 'VM.Config.Disk,VM.Config.HWType,VM.Config.Memory,VM.Config.Network,VM.Config.Options,' + . 'VM.Console,VM.Migrate,VM.Monitor,VM.PowerMgmt,VM.Snapshot,VM.Snapshot.Rollback', +); check_roles('max@pve', '/vms/200', 'storage_manager'); check_roles('joe@pve', '/vms/200', 'vm_admin');