community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From humbed...@apache.org
Subject svn commit: r1651878 - in /comdev/projects.apache.org/site/edit: index.py save.py
Date Wed, 14 Jan 2015 23:24:20 GMT
Author: humbedooh
Date: Wed Jan 14 23:24:19 2015
New Revision: 1651878

URL: http://svn.apache.org/r1651878
Log:
add a simple substitution script, fix save.py to use X-Authenticated-User

Added:
    comdev/projects.apache.org/site/edit/index.py
Modified:
    comdev/projects.apache.org/site/edit/save.py

Added: comdev/projects.apache.org/site/edit/index.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/site/edit/index.py?rev=1651878&view=auto
==============================================================================
--- comdev/projects.apache.org/site/edit/index.py (added)
+++ comdev/projects.apache.org/site/edit/index.py Wed Jan 14 23:24:19 2015
@@ -0,0 +1,16 @@
+import subprocess, re, os, time, sys, cgi
+print ("Content-Type: text/html\r\n\r\n")
+
+user = os.environ['HTTP_X_AUTHENTICATED_USER'] if 'HTTP_X_AUTHENTICATED_USER' in os.environ
else ""
+m = re.match(r"^([-a-zA-Z0-9_.]+)$", user)
+groups = []
+if m:
+    uid = m.group(1)
+    with open("index.html", "r") as f:
+        data = f.read()
+        f.close()
+        print(data.replace("%name%", uid))
+              
+else:
+    print("Unknown or invalid user id presented")
+        

Modified: comdev/projects.apache.org/site/edit/save.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/site/edit/save.py?rev=1651878&r1=1651877&r2=1651878&view=diff
==============================================================================
--- comdev/projects.apache.org/site/edit/save.py (original)
+++ comdev/projects.apache.org/site/edit/save.py Wed Jan 14 23:24:19 2015
@@ -13,7 +13,7 @@ print ("Received!")
 
 try:
     form = cgi.FieldStorage();
-    user = os.environ['REMOTE_USER'] if 'REMOTE_USER' in os.environ else "nobody"
+    user = os.environ['HTTP_X_AUTHENTICATED_USER'] if 'HTTP_X_AUTHENTICATED_USER' in os.environ
else "nobody"
     f = form['file'].value if 'file' in form else None
 
 



Mime
View raw message