mirror of
https://git.proxmox.com/git/pve-access-control
synced 2025-10-04 13:46:50 +00:00
special roles: code-style improvements for generation of special roles
no semantic change intended Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
588927f14a
commit
0aa00d13a4
@ -1150,24 +1150,25 @@ my $special_roles = {
|
|||||||
|
|
||||||
sub create_roles {
|
sub create_roles {
|
||||||
|
|
||||||
foreach my $cat (keys %$privgroups) {
|
for my $cat (keys %$privgroups) {
|
||||||
my $cd = $privgroups->{$cat};
|
my $cd = $privgroups->{$cat};
|
||||||
foreach my $p (@{$cd->{root}}, @{$cd->{admin}},
|
# create map to easily check if a privilege is valid
|
||||||
@{$cd->{user}}, @{$cd->{audit}}) {
|
for my $priv (@{$cd->{root}}, @{$cd->{admin}}, @{$cd->{user}}, @{$cd->{audit}}) {
|
||||||
$valid_privs->{$p} = 1;
|
$valid_privs->{$priv} = 1;
|
||||||
}
|
}
|
||||||
foreach my $p (@{$cd->{admin}}, @{$cd->{user}}, @{$cd->{audit}}) {
|
# create grouped admin roles and PVEAdmin
|
||||||
|
for my $priv (@{$cd->{admin}}, @{$cd->{user}}, @{$cd->{audit}}) {
|
||||||
$special_roles->{"PVE${cat}Admin"}->{$p} = 1;
|
$special_roles->{"PVE${cat}Admin"}->{$priv} = 1;
|
||||||
$special_roles->{"PVEAdmin"}->{$p} = 1;
|
$special_roles->{"PVEAdmin"}->{$priv} = 1;
|
||||||
}
|
}
|
||||||
|
# create grouped user and audit roles
|
||||||
if (scalar(@{$cd->{user}})) {
|
if (scalar(@{$cd->{user}})) {
|
||||||
foreach my $p (@{$cd->{user}}, @{$cd->{audit}}) {
|
for my $priv (@{$cd->{user}}, @{$cd->{audit}}) {
|
||||||
$special_roles->{"PVE${cat}User"}->{$p} = 1;
|
$special_roles->{"PVE${cat}User"}->{$priv} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach my $p (@{$cd->{audit}}) {
|
for my $priv (@{$cd->{audit}}) {
|
||||||
$special_roles->{"PVEAuditor"}->{$p} = 1;
|
$special_roles->{"PVEAuditor"}->{$priv} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user