Created
March 25, 2017 02:11
-
-
Save sigrlami/4366bcef368b77a0b07eab06a53bb665 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