whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: += code to generate public_ldap_authgroups.json
Date Fri, 12 Aug 2016 20:47:11 GMT
This is an automated email from the ASF dual-hosted git repository.

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

The following commit(s) were added to refs/heads/master by this push:
       new  9b01bf5   += code to generate public_ldap_authgroups.json
9b01bf5 is described below

commit 9b01bf58c6c1e9122c2ba1eca44086c58e92ab99
Author: Sebb <sebb@apache.org>
AuthorDate: Fri Aug 12 21:47:01 2016 +0100

    += code to generate public_ldap_authgroups.json
---
 www/public/README.html               |  1 +
 www/roster/public_ldap_authgroups.rb | 54 ++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/www/public/README.html b/www/public/README.html
index 558641c..e583322 100644
--- a/www/public/README.html
+++ b/www/public/README.html
@@ -4,6 +4,7 @@
       <dt>icla-info.json</dt><dd>Names of people who have submitted ICLAs
who have uids (committer accounts)</dd>
       <dt>icla-info_noid.json</dt><dd>Names of people who have submitted
ICLAs who don't have uids. Either the ICLA has yet to be processed, or it was submitted and
not followed up.</dd>
       <dt>member-info.json</dt><dd>ASF member names</dd>
+      <dt>public_ldap_authgroups.json</dt><dd>Membership of LDAP auth groups.
Membership of an LDAP auth group is used to grant commit karma for sub-project and other such
resources</dd>
       <dt>public_ldap_committees.json</dt><dd>Membership of LDAP committee
groups. Membership of an LDAP committee group != membership of the PMC</dd>
       <dt>public_ldap_groups.json</dt><dd>Membership of LDAP unix groups.
Membership of an LDAP unix group is used to grant commit karma for that project</dd>
       <dt>public_ldap_people.json</dt><dd>Basic details of LDAP personal
entries. Shows the public name and whether the login is currently disabled.</dd>
diff --git a/www/roster/public_ldap_authgroups.rb b/www/roster/public_ldap_authgroups.rb
new file mode 100644
index 0000000..432ed43
--- /dev/null
+++ b/www/roster/public_ldap_authgroups.rb
@@ -0,0 +1,54 @@
+# Creates JSON output with the following format:
+#
+# {
+# "lastTimestamp": "20160807004722Z",
+# "auth": {
+#   "accounting": {
+#     "createTimestamp": "20160802141719Z",
+#     "modifyTimestamp": "20160806162424Z",
+#     "roster": [
+#     ...
+#     ]
+#   },
+#   "apachecon": {
+#     "createTimestamp": "20160802141719Z",
+#     "modifyTimestamp": "20160802141719Z",
+#     "roster": [
+#     ...
+#   },
+# }
+#
+
+require_relative 'public_json_common'
+
+# gather auth group info
+entries = {}
+
+groups = ASF::AuthGroup.preload # for performance
+
+if groups.empty?
+  Wunderbar.error "No results retrieved, output not created"
+  exit 0
+end
+
+lastStamp = ''
+groups.keys.sort_by {|a| a.name}.each do |entry|
+    m = []
+    entry.members.sort_by {|a| a.name}.each do |e|
+        m << e.name
+    end
+    lastStamp = entry.modifyTimestamp if entry.modifyTimestamp > lastStamp
+    entries[entry.name] = {
+        createTimestamp: entry.createTimestamp,
+        modifyTimestamp: entry.modifyTimestamp,
+        roster: m 
+    }
+end
+
+info = {
+  # Is there a use case for the last createTimestamp ?
+  lastTimestamp: lastStamp,
+  auth: entries,
+}
+
+public_json_output(info)

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Mime
View raw message