You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by hu...@apache.org on 2019/07/31 19:22:12 UTC
svn commit: r1864099 - /comdev/reporter.apache.org/trunk/site/getjson.py
Author: humbedooh
Date: Wed Jul 31 19:22:11 2019
New Revision: 1864099
URL: http://svn.apache.org/viewvc?rev=1864099&view=rev
Log:
Allow for anonymous access to the public data we have.
Modified:
comdev/reporter.apache.org/trunk/site/getjson.py
Modified: comdev/reporter.apache.org/trunk/site/getjson.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/getjson.py?rev=1864099&r1=1864098&r2=1864099&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/getjson.py (original)
+++ comdev/reporter.apache.org/trunk/site/getjson.py Wed Jul 31 19:22:11 2019
@@ -7,7 +7,7 @@
data/JIRA/%.json - for each JIRA project
Usage:
- getjson.py[?only=pmcname|pmcname-to-include]
+ getjson.py[?only=pmcname|pmcname-to-include][&anon=yes]
Reads the following:
data/JIRA/jira_projects.json
@@ -27,6 +27,7 @@
HTTP_X_AUTHENTICATED_USER - set by Apache webserver
QUERY_STRING - additional group to include
ONLY - equivalent to ?only CGI param
+ ANON - allows for anonymous (redacted) access by normal committers
"""
import os, sys, re, json, subprocess, time
@@ -49,6 +50,7 @@ PROJECTS = 'https://whimsy.apache.org/pu
# Pick up environment settings
form = cgi.FieldStorage();
oproject = form['only'].value if ('only' in form and len(form['only'].value) > 0) else os.environ['ONLY'] if 'ONLY' in os.environ else None
+anon = form.getvalue('anon')
user = os.environ['HTTP_X_AUTHENTICATED_USER'] if 'HTTP_X_AUTHENTICATED_USER' in os.environ else ""
include = os.environ['QUERY_STRING'] if 'QUERY_STRING' in os.environ else None
@@ -237,9 +239,9 @@ if re.match(r"^[-a-zA-Z0-9_.]+$", user):
isMember = isMember(user)
groups = getPMCs(user)
- if include and isMember and not include in groups and len(include) > 1:
+ if include and (isMember or anon) and not include in groups and len(include) > 1:
groups.append(include)
- if oproject and len(oproject) > 0 and isMember:
+ if oproject and len(oproject) > 0 and (isMember or anon):
groups = [oproject]
groups.sort() # so tabs appear in order
@@ -248,6 +250,8 @@ if re.match(r"^[-a-zA-Z0-9_.]+$", user):
if (os.path.exists(wanted_file) and os.path.getmtime(wanted_file) > (time.time() - 7200)):
dump = json.load(open(wanted_file, "r"))
dump['you'] = committers[user]
+ if anon:
+ dump['mail'] = {}
dump = json.dumps(dump)
sys.stdout.write("Content-Type: application/json\r\nContent-Length: %u\r\n\r\n" % (len(dump)))
sys.stdout.write(dump)
@@ -362,6 +366,8 @@ if re.match(r"^[-a-zA-Z0-9_.]+$", user):
checker[group]['meta'] = meta
if not isMember:
allpmcs = []
+ if anon:
+ mlstats = {}
output = {
'count': count,
'pmcs': groups,