Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(defroutes app-routes
;; Customers
(context "/customer" []
(GET "/list" [] (-> get-customers
(restrict {:handler {:and [authenticated-user
(user-can "manage-customers")]}
:on-error unauthorized-handler})))
(POST "/customer" [] create-customer)
(context "/:id" [id]
(restrict
(routes
(GET "/" [] find-user)
(GET "/lists" [] lists-for-customer))
{:handler {:and [authenticated-user
{:or [(user-can "manage-customers")
(user-has-id (read-string id))]}]}
:on-error unauthorized-handler}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment