whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Bazley <s...@apache.org>
Subject [whimsy.git] [1/1] Commit 7dd95d7: Record the last modified dates for each LDAP group
Date Sat, 23 Jan 2016 17:49:59 GMT
Commit 7dd95d7f61d5f6a79f5fce65e9e8001305358a21:
    Record the last modified dates for each LDAP group


Branch: refs/heads/master
Author: Sebb <sebb@apache.org>
Committer: Sebb <sebb@apache.org>
Pusher: sebb <sebb@apache.org>

------------------------------------------------------------
www/roster/public_ldap_committees.rb                         | +++++++ ----
www/roster/public_ldap_groups.rb                             | +++++++ ----
------------------------------------------------------------
42 changes: 28 additions, 14 deletions.
------------------------------------------------------------


diff --git a/www/roster/public_ldap_committees.rb b/www/roster/public_ldap_committees.rb
index 69ddd1e..91d6c9b 100644
--- a/www/roster/public_ldap_committees.rb
+++ b/www/roster/public_ldap_committees.rb
@@ -1,13 +1,15 @@
 # Creates JSON output with the following format:
 #
 # {
-#   "last_updated": "2016-01-20 00:47:45 UTC",
+#   "lastTimestamp": "20160119171152Z", // most recent modifyTimestamp
 #   "git_info": "9d1cefc  2016-01-22T11:44:14+00:00",
 #   "committees": {
-#     "abdera": [
-#       "uid",
+#     "abdera": {
+#       "modifyTimestamp": "20111204095436Z",
+#       "roster": ["uid",
 #       ...
-#     ],
+#       ]
+#     },
 #     ...
 #   },
 # }
@@ -22,21 +24,26 @@
 ldap = ASF.init_ldap
 exit 1 unless ldap
 
-# gather committer info
+# gather committee info
 entries = {}
 
 committees = ASF::Committee.preload # for performance
 
+lastStamp = ''
 committees.keys.sort_by {|a| a.name}.each do |entry|
     m = []
     entry.members.sort_by {|a| a.name}.each do |e|
         m << e.name
     end
-    entries[entry.name] = m
+    lastStamp = entry.modifyTimestamp if entry.modifyTimestamp > lastStamp
+    entries[entry.name] = {
+        modifyTimestamp: entry.modifyTimestamp,
+        roster: m 
+    }
 end
 
 info = {
-  last_updated: ASF::ICLA.svn_change,
+  lastTimestamp: lastStamp,
   git_info: GITINFO,
   committees: entries,
 }
diff --git a/www/roster/public_ldap_groups.rb b/www/roster/public_ldap_groups.rb
index ff0edbf..5bfedae 100644
--- a/www/roster/public_ldap_groups.rb
+++ b/www/roster/public_ldap_groups.rb
@@ -1,13 +1,15 @@
 # Creates JSON output with the following format:
 #
 # {
-#   "last_updated": "2016-01-20 00:47:45 UTC",
+#   "lastTimestamp": "20160119171152Z", // most recent modifyTimestamp
 #   "git_info": "9d1cefc  2016-01-22T11:44:14+00:00",
 #   "groups": {
-#     "abdera": [
-#       "uid",
+#     "abdera": {
+#       "modifyTimestamp": "20111204095436Z",
+#       "roster": ["uid",
 #       ...
-#     ],
+#       ]
+#     },
 #     ...
 #   },
 # }
@@ -22,22 +24,27 @@
 ldap = ASF.init_ldap
 exit 1 unless ldap
 
-# gather committer info
+# gather unix group info
 entries = {}
 
 groups = ASF::Group.preload # for performance
 
+lastStamp = ''
 groups.keys.sort_by {|a| a.name}.each do |entry|
     next if entry.name == 'committers'
     m = []
     entry.members.sort_by {|a| a.name}.each do |e|
         m << e.name
     end
-    entries[entry.name] = m
+    lastStamp = entry.modifyTimestamp if entry.modifyTimestamp > lastStamp
+    entries[entry.name] = {
+        modifyTimestamp: entry.modifyTimestamp,
+        roster: m 
+    }
 end
 
 info = {
-  last_updated: ASF::ICLA.svn_change,
+  lastTimestamp: lastStamp,
   git_info: GITINFO,
   groups: entries,
 }

Mime
View raw message