API: add group members to group index
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 21 Jan 2020 12:54:15 +0000 (13:54 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 28 Jan 2020 19:56:55 +0000 (20:56 +0100)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
PVE/API2/Group.pm

index 37f8be2..c463bd6 100644 (file)
@@ -38,6 +38,12 @@ __PACKAGE__->register_method ({
            properties => {
                groupid => get_standard_option('group-id'),
                comment => get_standard_option('group-comment'),
+               users => {
+                   type => 'string',
+                   format => 'pve-userid-list',
+                   optional => 1,
+                   description => 'list of users which form this group',
+               },
            },
        },
        links => [ { rel => 'child', href => "{groupid}" } ],
@@ -58,6 +64,7 @@ __PACKAGE__->register_method ({
            my $data = $usercfg->{groups}->{$group};
            my $entry = { groupid => $group };
            $entry->{comment} = $data->{comment} if defined($data->{comment});
+           $entry->{users} = join (',', sort keys %{$data->{users}}) if defined($data->{users});
            push @$res, $entry;
        }