X-Git-Url: https://git.proxmox.com/?p=pve-access-control.git;a=blobdiff_plain;f=PVE%2FAPI2%2FAccessControl.pm;fp=PVE%2FAPI2%2FAccessControl.pm;h=c2324e8f7fa908da09633400bef350ccaf05387b;hp=6d0ea82dde6594417242215318c68a95c8a1eebf;hb=0fb0c62d742c0dd16a1db6c0d67ec6de215ef4da;hpb=6bc6a78ac0904069281f5fa8164178019f9da867 diff --git a/PVE/API2/AccessControl.pm b/PVE/API2/AccessControl.pm index 6d0ea82..c2324e8 100644 --- a/PVE/API2/AccessControl.pm +++ b/PVE/API2/AccessControl.pm @@ -10,7 +10,6 @@ use PVE::Exception qw(raise raise_perm_exc); use PVE::SafeSyslog; use PVE::RPCEnvironment; use PVE::Cluster qw(cfs_read_file); -use PVE::Corosync; use PVE::RESTHandler; use PVE::AccessControl; use PVE::JSONSchema qw(get_standard_option); @@ -314,17 +313,9 @@ __PACKAGE__->register_method ({ $res->{cap} = &$compute_api_permission($rpcenv, $username) if !defined($res->{NeedTFA}); - if (PVE::Corosync::check_conf_exists(1)) { - if ($rpcenv->check($username, '/', ['Sys.Audit'], 1)) { - eval { - my $conf = cfs_read_file('corosync.conf'); - my $totem = PVE::Corosync::totem_config($conf); - if ($totem->{cluster_name}) { - $res->{clustername} = $totem->{cluster_name}; - } - }; - warn "$@\n" if $@; - } + my $clinfo = PVE::Cluster::get_clinfo(); + if ($clinfo->{cluster}->{name} && $rpcenv->check($username, '/', ['Sys.Audit'], 1)) { + $res->{clustername} = $clinfo->{cluster}->{name}; } PVE::Cluster::log_msg('info', 'root@pam', "successful auth for user '$username'");