This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 12e8fff  Add individual roster counts and summary
12e8fff is described below

commit 12e8fff272b73d79b705264b81637264d92047f2
Author: Sebb <[email protected]>
AuthorDate: Fri Sep 10 13:41:20 2021 +0100

    Add individual roster counts and summary
---
 www/roster/public_ldap_authgroups.rb | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/www/roster/public_ldap_authgroups.rb 
b/www/roster/public_ldap_authgroups.rb
index e44104c..27e752d 100644
--- a/www/roster/public_ldap_authgroups.rb
+++ b/www/roster/public_ldap_authgroups.rb
@@ -3,10 +3,16 @@
 #
 # {
 # "lastTimestamp": "20160807004722Z",
+# "roster_counts": {
+#   "accounting": 3,
+#   "apachecon": 34,
+#    ...
+# }
 # "auth": {
 #   "accounting": {
 #     "createTimestamp": "20160802141719Z",
 #     "modifyTimestamp": "20160806162424Z",
+#     "roster_count": 123,
 #     "roster": [
 #     ...
 #     ]
@@ -14,6 +20,7 @@
 #   "apachecon": {
 #     "createTimestamp": "20160802141719Z",
 #     "modifyTimestamp": "20160802141719Z",
+#     "roster_count": 123,
 #     "roster": [
 #     ...
 #   },
@@ -33,6 +40,7 @@ if groups.empty?
 end
 
 lastStamp = ''
+roster_counts = Hash.new(0)
 groups.keys.sort_by(&:name).each do |entry|
   m = []
   entry.members.sort_by(&:name).each do |e|
@@ -42,13 +50,17 @@ groups.keys.sort_by(&:name).each do |entry|
   entries[entry.name] = {
     createTimestamp: entry.createTimestamp,
     modifyTimestamp: entry.modifyTimestamp,
+    roster_count: m.size,
     roster: m
   }
+  roster_counts[entry.name] = m.size
 end
 
 info = {
   # Is there a use case for the last createTimestamp ?
   lastTimestamp: lastStamp,
+  # Summarise the counts in the following entries for ease of access
+  roster_counts: roster_counts,
   auth: entries,
 }
 

Reply via email to