fix #6889: ldap sync: use the description of groups as comment
Synced users get their comment from the 'comment' attribute, but synced groups never get one, as only the name and the members of a group are queried. With FreeIPA for example, groups are described with the 'description' attribute, which is then not visible in Proxmox VE. Set the comment of a synced group to its description, if it has one. Like for the attributes of users, an existing comment is overwritten by the synced one, and kept if the group has no description, unless 'properties' is part of 'remove-vanished'. Signed-off-by: Michal Fox <me@dualfroz.com>
This commit is contained in:
1 parent
0a15bc820b
commit
96d1c6ff89
2 files changed
+8
-1
No files matched your search
@@ -387,6 +387,7 @@ sub get_groups {
|
||||
}
|
||||
|
||||
$ret->{$name} = { users => {} };
|
||||
$ret->{$name}->{comment} = $group->{description} if defined($group->{description});
|
||||
foreach my $member (@{ $group->{members} }) {
|
||||
if (my $user = $dnmap->{ lc($member) }) {
|
||||
$ret->{$name}->{users}->{$user} = 1;
|
||||
|
||||
@@ -36,7 +36,7 @@ my $initialusercfg = {
|
||||
},
|
||||
},
|
||||
groups => {
|
||||
'group1-syncedrealm' => { users => {} },
|
||||
'group1-syncedrealm' => { users => {}, comment => 'outdated comment' },
|
||||
'group2-syncedrealm' => { users => {} },
|
||||
},
|
||||
acl_root => {
|
||||
@@ -65,6 +65,7 @@ my $sync_response = {
|
||||
groups => [
|
||||
{
|
||||
dn => 'dc=group1,dc=syncedrealm',
|
||||
description => 'First group',
|
||||
members => [
|
||||
'uid=user1,dc=syncedrealm',
|
||||
],
|
||||
@@ -176,6 +177,7 @@ my $tests = [
|
||||
users => {
|
||||
'user1@syncedrealm' => 1,
|
||||
},
|
||||
comment => 'First group',
|
||||
},
|
||||
'group2-syncedrealm' => { users => {} },
|
||||
'group3-syncedrealm' => { users => {} },
|
||||
@@ -216,6 +218,7 @@ my $tests = [
|
||||
users => {
|
||||
'user1@syncedrealm' => 1,
|
||||
},
|
||||
comment => 'First group',
|
||||
},
|
||||
'group3-syncedrealm' => { users => {} },
|
||||
},
|
||||
@@ -260,6 +263,7 @@ my $tests = [
|
||||
users => {
|
||||
'user1@syncedrealm' => 1,
|
||||
},
|
||||
comment => 'First group',
|
||||
},
|
||||
'group2-syncedrealm' => { users => {} },
|
||||
'group3-syncedrealm' => { users => {} },
|
||||
@@ -298,6 +302,7 @@ my $tests = [
|
||||
users => {
|
||||
'user1@syncedrealm' => 1,
|
||||
},
|
||||
comment => 'First group',
|
||||
},
|
||||
'group3-syncedrealm' => { users => {} },
|
||||
},
|
||||
@@ -336,6 +341,7 @@ my $tests = [
|
||||
users => {
|
||||
'user1@syncedrealm' => 1,
|
||||
},
|
||||
comment => 'First group',
|
||||
},
|
||||
'group3-syncedrealm' => { users => {} },
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user