mirror of
https://git.proxmox.com/git/pve-access-control
synced 2025-07-27 03:03:04 +00:00
allow user to see his own entry
This commit is contained in:
parent
fdb30a4cc5
commit
930dcfc8b0
@ -36,6 +36,7 @@ __PACKAGE__->register_method ({
|
||||
path => '',
|
||||
method => 'GET',
|
||||
description => "User index.",
|
||||
permissions => { user => 'all' },
|
||||
parameters => {
|
||||
additionalProperties => 0,
|
||||
properties => {
|
||||
@ -59,13 +60,17 @@ __PACKAGE__->register_method ({
|
||||
code => sub {
|
||||
my ($param) = @_;
|
||||
|
||||
my $rpcenv = PVE::RPCEnvironment::get();
|
||||
my $authuser = $rpcenv->get_user();
|
||||
|
||||
my $res = [];
|
||||
|
||||
my $usercfg = cfs_read_file("user.cfg");
|
||||
|
||||
foreach my $user (keys %{$usercfg->{users}}) {
|
||||
next if $user eq 'root';
|
||||
|
||||
# root sees all entries, a user only sees its own entry
|
||||
next if $authuser ne 'root@pam' && $user ne $authuser;
|
||||
|
||||
my $entry = &$extract_user_data($usercfg->{users}->{$user});
|
||||
|
||||
if (defined($param->{enabled})) {
|
||||
|
Loading…
Reference in New Issue
Block a user