Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit. Simple Ring middleware for supplying appengine user i…

…nfo.
  • Loading branch information...
commit ad198c7b90553b5e380b29acf6466f9dab7031b9 0 parents
@duelinmarkers authored
Showing with 54 additions and 0 deletions.
  1. +2 −0  .gitignore
  2. +41 −0 build.xml
  3. +11 −0 src/appengine_clj/users.clj
2  .gitignore
@@ -0,0 +1,2 @@
+appengine-clj.jar
+classes
41 build.xml
@@ -0,0 +1,41 @@
+<project name="appengine-clj" basedir="." default="compile">
+
+ <property name="sdk.dir" location="../appengine-java-sdk" />
+ <property name="classes.dir" value="classes" />
+ <property name="lib.dir" value="lib" />
+ <property name="src.dir" value="src" />
+ <property name="jar.file" value="appengine-clj.jar" />
+
+ <path id="project.classpath">
+ <pathelement path="${classes.dir}" />
+ <fileset dir="${lib.dir}">
+ <include name="**/*.jar" />
+ </fileset>
+ <fileset dir="${sdk.dir}/lib">
+ <include name="**/*.jar" />
+ </fileset>
+ </path>
+
+ <target name="clean">
+ <delete dir="${classes.dir}" />
+ <delete file="${jar.file}" />
+ </target>
+
+ <target name="init">
+ <mkdir dir="${classes.dir}" />
+ </target>
+
+ <target name="compile" depends="clean,init">
+ <java classname="clojure.lang.Compile" classpathref="project.classpath" failonerror="true">
+ <classpath path="${src.dir}" />
+ <sysproperty key="clojure.compile.path" value="${classes.dir}" />
+ <arg value="appengine-clj.users" />
+ </java>
+ </target>
+
+ <target name="jar" depends="compile">
+ <jar jarfile="${jar.file}" basedir="${classes.dir}" />
+ </target>
+
+</project>
+
11 src/appengine_clj/users.clj
@@ -0,0 +1,11 @@
+(ns appengine-clj.users
+ (:import
+ (com.google.appengine.api.users User UserService UserServiceFactory)))
+
+
+(defn wrap-with-user-info [application]
+ (fn [request]
+ (let [user-service (UserServiceFactory/getUserService)
+ user (.getCurrentUser user-service)]
+ (application (assoc request :appengine-clj/user-info {:user user :user-service user-service})))))
+
Please sign in to comment.
Something went wrong with that request. Please try again.