Skip to content

Commit 1ae87be

Browse files
committed
Show who last updated the group
1 parent be51b6a commit 1ae87be

5 files changed

Lines changed: 19 additions & 3 deletions

File tree

lib/whimsy/asf/ldap.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,10 +1144,11 @@ def include?(person)
11441144
# fetch <tt>dn</tt>, <tt>member</tt>, <tt>modifyTimestamp</tt>, and
11451145
# <tt>createTimestamp</tt> for all groups in LDAP.
11461146
def self.preload
1147-
Hash[ASF.search_one(base, 'cn=*', %w(dn memberUid modifyTimestamp createTimestamp)).map do |results|
1147+
Hash[ASF.search_one(base, 'cn=*', %w(dn memberUid modifyTimestamp modifiersName createTimestamp)).map do |results|
11481148
cn = results['dn'].first[/^cn=(.*?),/, 1]
11491149
group = ASF::Group.find(cn)
11501150
group.modifyTimestamp = results['modifyTimestamp'].first # it is returned as an array of 1 entry
1151+
group.modifiersName = results['modifiersName'].first # it is returned as an array of 1 entry
11511152
group.createTimestamp = results['createTimestamp'].first # it is returned as an array of 1 entry
11521153
members = results['memberUid'] || []
11531154
group.members = members
@@ -1158,6 +1159,9 @@ def self.preload
11581159
# Date this committee was last modified in LDAP.
11591160
attr_accessor :modifyTimestamp
11601161

1162+
# Who made the last change
1163+
attr_accessor :modifiersName
1164+
11611165
# Date this committee was initially created in LDAP.
11621166
attr_accessor :createTimestamp
11631167

@@ -1259,10 +1263,11 @@ def self.[](name)
12591263
# fetch <tt>dn</tt>, <tt>member</tt>, <tt>modifyTimestamp</tt>, and
12601264
# <tt>createTimestamp</tt> for all projects in LDAP.
12611265
def self.preload
1262-
Hash[ASF.search_one(base, 'cn=*', %w(dn member owner modifyTimestamp createTimestamp)).map do |results|
1266+
Hash[ASF.search_one(base, 'cn=*', %w(dn member owner modifyTimestamp modifiersName createTimestamp)).map do |results|
12631267
cn = results['dn'].first[/^cn=(.*?),/, 1]
12641268
project = self.find(cn)
12651269
project.modifyTimestamp = results['modifyTimestamp'].first # it is returned as an array of 1 entry
1270+
project.modifiersName = results['modifiersName'].first # it is returned as an array of 1 entry
12661271
project.createTimestamp = results['createTimestamp'].first # it is returned as an array of 1 entry
12671272
members = results['member'] || []
12681273
owners = results['owner'] || []
@@ -1276,6 +1281,9 @@ def self.preload
12761281
# Date this committee was last modified in LDAP.
12771282
attr_accessor :modifyTimestamp
12781283

1284+
# Who made the last change
1285+
attr_accessor :modifiersName
1286+
12791287
# Date this committee was initially created in LDAP.
12801288
attr_accessor :createTimestamp
12811289

@@ -1513,10 +1521,11 @@ def base
15131521
# <tt>createTimestamp</tt> for all services in LDAP.
15141522
# N.B. some services have memberUid rather than member entries
15151523
def self.preload
1516-
Hash[ASF.search_one(base, 'cn=*', %w(dn member memberUid modifyTimestamp createTimestamp)).map do |results|
1524+
Hash[ASF.search_one(base, 'cn=*', %w(dn member memberUid modifyTimestamp modifiersName createTimestamp)).map do |results|
15171525
cn = results['dn'].first[/^cn=(.*?),/, 1]
15181526
service = self.find(cn)
15191527
service.modifyTimestamp = results['modifyTimestamp'].first # it is returned as an array of 1 entry
1528+
service.modifiersName = results['modifiersName'].first # it is returned as an array of 1 entry
15201529
service.createTimestamp = results['createTimestamp'].first # it is returned as an array of 1 entry
15211530
members = results['member'] || results['memberUid'].map {|k| ASF::Person.dn(k)} || []
15221531
service.members = members
@@ -1527,6 +1536,9 @@ def self.preload
15271536
# Date this committee was last modified in LDAP.
15281537
attr_accessor :modifyTimestamp
15291538

1539+
# Who made the last change
1540+
attr_accessor :modifiersName
1541+
15301542
# Date this committee was initially created in LDAP.
15311543
attr_accessor :createTimestamp
15321544

www/roster/public_ldap_authgroups.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
entries[entry.name] = {
5252
createTimestamp: entry.createTimestamp,
5353
modifyTimestamp: entry.modifyTimestamp,
54+
modifiersName: entry.modifiersName,
5455
roster_count: m.size,
5556
roster: m
5657
}

www/roster/public_ldap_groups.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
entries[group.name] = {
4747
createTimestamp: createTimestamp,
4848
modifyTimestamp: modifyTimestamp,
49+
modifiersName: group.modifiersName,
4950
roster_count: m.size,
5051
roster: m
5152
}

www/roster/public_ldap_projects.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def to_json(*_opts)
8080
entries[entry.name] = {
8181
createTimestamp: entry.createTimestamp,
8282
modifyTimestamp: entry.modifyTimestamp,
83+
modifiersName: entry.modifiersName,
8384
member_count: m.size,
8485
owner_count: o.size,
8586
members: m,

www/roster/public_ldap_services.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
entries[entry.name] = {
4646
createTimestamp: entry.createTimestamp,
4747
modifyTimestamp: entry.modifyTimestamp,
48+
modifiersName: entry.modifiersName,
4849
roster_count: m.size,
4950
roster: m
5051
}

0 commit comments

Comments
 (0)