adds glimpse for power users

This commit is contained in:
2024-04-24 22:56:10 -07:00
parent 1de86104d7
commit b537e99ecf
5 changed files with 125 additions and 87 deletions

View File

@@ -1,4 +1,6 @@
(ns auto-ap.permissions)
(ns auto-ap.permissions
#?(:clj
(:require [cemerick.url :as url])))
;; TODO after getting rid of cljs, use malli schemas to decode this
(defn get-client-id [client]
@@ -113,3 +115,13 @@
:else
false)))
#? (:clj
(defn wrap-must [handler policy]
(fn [request]
(if (can? (:identity request) policy)
(handler request)
{:status 302
:headers {"Location" (str "/login?"
(url/map->query {"redirect-to" (:uri request)}))}}))))