Liking cljdoc? Tell your friends :D

metabase.middleware.session

Ring middleware related to session (binding current user and permissions).

Ring middleware related to session (binding current user and permissions).
raw docstring

bind-current-userclj

(bind-current-user handler)

Middleware that binds metabase.api.common/*current-user*, *current-user-id*, *is-superuser?*, and *current-user-permissions-set*.

  • *current-user-id* int ID or nil of user associated with request
  • *current-user* delay that returns current user (or nil) from DB
  • *is-superuser?* Boolean stating whether current user is a superuser.
  • current-user-permissions-set* delay that returns the set of permissions granted to the current user from DB
Middleware that binds `metabase.api.common/*current-user*`, `*current-user-id*`, `*is-superuser?*`, and
`*current-user-permissions-set*`.

*  `*current-user-id*`             int ID or nil of user associated with request
*  `*current-user*`                delay that returns current user (or nil) from DB
*  `*is-superuser?*`               Boolean stating whether current user is a superuser.
*  `current-user-permissions-set*` delay that returns the set of permissions granted to the current user from DB
sourceraw docstring

(clear-session-cookie response)

Add a header to response to clear the current Metabase session cookie.

Add a header to `response` to clear the current Metabase session cookie.
sourceraw docstring

(set-session-cookie request response session-id)

Inputs: [request response session-id :- UUID]

Add a Set-Cookie header to response to persist the Metabase session.

Inputs: [request response session-id :- UUID]

Add a `Set-Cookie` header to `response` to persist the Metabase session.
sourceraw docstring

wrap-current-user-idclj

(wrap-current-user-id handler)

Add :metabase-user-id to the request if a valid session token was passed.

Add `:metabase-user-id` to the request if a valid session token was passed.
sourceraw docstring

wrap-session-idclj

(wrap-session-id handler)

Middleware that sets the :metabase-session-id keyword on the request if a session id can be found.

We first check the request :cookies for metabase.SESSION_ID, then if no cookie is found we look in the http headers for X-METABASE-SESSION. If neither is found then then no keyword is bound to the request.

Middleware that sets the `:metabase-session-id` keyword on the request if a session id can be found.

We first check the request :cookies for `metabase.SESSION_ID`, then if no cookie is found we look in the
http headers for `X-METABASE-SESSION`.  If neither is found then then no keyword is bound to the request.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close