use PVE::INotify;
use PVE::RESTEnvironment;
+use PVE::Exception qw(raise_perm_exc);
use PMG::Cluster;
use PMG::ClusterConfig;
$self->{ticket} = undef;
$self->{role} = undef;
+ $self->{format} = undef;
$self->{cinfo} = PVE::INotify::read_file("cluster.conf");
$self->{usercfg} = PVE::INotify::read_file("pmg-user.conf");
}
$rest_env->set_role('root');
}
+sub set_format {
+ my ($self, $ticket) = @_;
+
+ $self->{format} = $ticket;
+}
+
+sub get_format {
+ my ($self) = @_;
+
+ return $self->{format} // 'json';
+}
+
sub set_ticket {
my ($self, $ticket) = @_;
my $role = $self->{role};
if (my $allowed_roles = $perm->{check}) {
+ if ($role eq 'helpdesk') {
+ # helpdesk is qmanager + audit
+ return 1 if grep { $_ eq 'audit' } @$allowed_roles;
+ return 1 if grep { $_ eq 'qmanager' } @$allowed_roles;
+ }
return 1 if grep { $_ eq $role } @$allowed_roles;
}