Skip to content

Instantly share code, notes, and snippets.

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