Created
May 20, 2020 13:33
-
-
Save geraldodev/9251af0c18ed219c73870e07e2e06d8d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(defn wrap-enforce-roles [handler] | |
(fn [{::keys [roles request-method] :as request}] | |
(let [required (some-> request (ring/get-match) :data request-method ::roles)] | |
(if (and (seq required) (not (set/subset? required roles))) | |
{:status 403, :body "forbidden"} | |
(handler request))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment