Skip to content

Instantly share code, notes, and snippets.

@sigrlami
Created March 25, 2017 02:11
Show Gist options
  • Save sigrlami/4366bcef368b77a0b07eab06a53bb665 to your computer and use it in GitHub Desktop.
Save sigrlami/4366bcef368b77a0b07eab06a53bb665 to your computer and use it in GitHub Desktop.
(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