Skip to content

Instantly share code, notes, and snippets.

@charles-dyfis-net
Created May 25, 2012 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charles-dyfis-net/153833c315cdde8361f4 to your computer and use it in GitHub Desktop.
Save charles-dyfis-net/153833c315cdde8361f4 to your computer and use it in GitHub Desktop.
;=> auth-context
#<Delay@2cca1df3: #<JiraAuthenticationContextImpl com.atlassian.jira.security.JiraAuthenticationContextImpl@142a3945>>
;=> (defmacro as-user [user & body]
`(let [old-user# (.getUser @auth-context ~user)]
(.setUser @auth-context ~user)
(try
~@body
(finally (.setUser @auth-context old-user#)))))
#'com.indeed.jira-releng-plugin.jira/as-user
;=> (macroexpand '(as-user FOO (bar baz)))
(let* [old-user__942__auto__ (.getUser (clojure.core/deref clojure.core/auth-context) FOO)] (.setUser (clojure.core/deref clojure.core/auth-context) FOO) (try (bar baz) (finally (.setUser (clojure.core/deref clojure.core/auth-context) old│
-user__942__auto__))))
;;; ...the clojure.core/auth-context references are the immediate issue here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment