Browse files


  • Loading branch information...
1 parent 3739669 commit f82add24a4025c32a2e3fd44dc614ec489e6077f @duelinmarkers committed Mar 30, 2009
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/appengine_clj/users.clj
10 src/appengine_clj/users.clj
@@ -3,11 +3,17 @@
( User UserService UserServiceFactory)))
-(defn user-info []
+(defn user-info
+ "Returns a UserService and User for the current request in a map keyed by :user-service and :user respectively.
+ if the user is not logged in, :user will be nil."
+ []
(let [user-service (UserServiceFactory/getUserService)]
{:user (.getCurrentUser user-service) :user-service user-service}))
-(defn wrap-with-user-info [application]
+(defn wrap-with-user-info
+ "Ring middleware method that wraps an application so that every request will have
+ a user-info map assoc'd to the request under the key :appengine-clj/user-info."
+ [application]
(fn [request]
(application (assoc request :appengine-clj/user-info (user-info)))))

0 comments on commit f82add2

Please sign in to comment.