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/2] Commit a168807: Makes more sense to keep personal details together so each uid appears
Date Sun, 24 Jan 2016 14:22:02 GMT
Commit a16880742e06cca261f98a06fba476e273d79ed0:
    Makes more sense to keep personal details together so each uid appears
    once only. The uid data can later be expanded if necessary


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

------------------------------------------------------------
www/roster/public_ldap_committers.rb                         | +++++ -----
------------------------------------------------------------
69 changes: 34 additions, 35 deletions.
------------------------------------------------------------


diff --git a/www/roster/public_ldap_committers.rb b/www/roster/public_ldap_committers.rb
index e039fda..da9401a 100644
--- a/www/roster/public_ldap_committers.rb
+++ b/www/roster/public_ldap_committers.rb
@@ -1,21 +1,20 @@
 # Creates JSON output with the following format:
 #
 # {
-#   "committers": { // committers who have valid login shells
-#     "uid": "Public Name",
+#   "committers": {
+#     "uid": {
+#       "name": "Public Name",
+#       "noLogin": true // present only if the login is not valid
+#     }
 #     ...
 #   },
-#   "committers_nologin": { // committers with invalid login shells
-#     "uid": "Public Name",
+#   "non_committers": { // entries in 'ou=people,dc=apache,dc=org' who are not committers
+#     "uid": {
+#       "name": "Public Name",
+#       "noLogin": true // present only if the login is not valid
+#     }
 #     ...
 #   },
-#   "non_committers": { // entries in 'ou=people,dc=apache,dc=org' who are not committers
but who can login
-#     "uid": "Public Name",
-#     ...
-#   },
-#   "non_committers_nologin": { // entries in 'ou=people,dc=apache,dc=org' who are not committers
and have invalid shells
-#     "uid": "Public Name",
-#     ...
 # }
 #
 
@@ -28,44 +27,44 @@
 ldap = ASF.init_ldap
 exit 1 unless ldap
 
-# normal members of the AS
-ids = {}
-# still a committer, but banned or deceased or emeritus or ...
-ban = {}
-# people entries that are not committers (and not in nologin)
-non = {}
-# people entries that are not committers (in nologin)
-nonb = {}
+# ASF committers
+com = {}
+# people entries that are not committers
+peo = {}
 
 comms = ASF.committers
 peeps = ASF::Person.preload(['cn', 'loginShell']) # for performance
 
-# For each ASF committer group member, check if they can login:
-comms.sort_by {|a| a.id}.each do |entry|
-    if entry.banned?
-        ban[entry.id] = entry.public_name 
-    else
-        ids[entry.id] = entry.public_name 
-    end
+# Make output smaller by ommitting commonest case (noLogin: false)
+def makeEntry(hash, e)
+  if e.banned?
+    hash[e.id] = {
+        name: e.public_name,
+        noLogin: true
+    }
+  else
+    hash[e.id] = {
+        name: e.public_name,
+    }
+  end
+end
+
+# List each ASF committer group member 
+comms.sort_by {|a| a.id}.each do |e|
+  makeEntry(com, e)
 end
 
 # Now see if there are any left-over people
 peeps.sort_by {|a| a.name}.each do |e|
   unless comms.include? e
-     if e.banned?
-         nonb[e.name] = e.public_name
-     else
-         non[e.name] = e.public_name
-     end
+    makeEntry(peo, e)
   end
 end
 
 info = {
   # There does not seem to be a useful timestamp here
-  committers: ids,
-  committers_nologin: ban,
-  non_committers: non,
-  non_committers_nologin: nonb,
+  committers: com,
+  non_committers: peo,
 }
 
 # format as JSON

Mime
View raw message