Created
March 25, 2017 02:11
-
-
Save sigrlami/62b18e2e8142dd5ec5b9902cc1cc7589 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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