Liking cljdoc? Tell your friends :D

metabase.models.interface


current-user-has-full-permissions?clj

(current-user-has-full-permissions? perms-set)
(current-user-has-full-permissions? read-or-write object)
(current-user-has-full-permissions? read-or-write entity object-id)

Implementation of can-read?/can-write? for the old permissions system. true if the current user has full permissions for the paths returned by its implementation of perms-objects-set. (READ-OR-WRITE is either :read or :write and passed to perms-objects-set; you'll usually want to partially bind it in the implementation map).

Implementation of `can-read?`/`can-write?` for the old permissions system. `true` if the current user has *full*
permissions for the paths returned by its implementation of `perms-objects-set`. (READ-OR-WRITE is either `:read` or
`:write` and passed to `perms-objects-set`; you'll usually want to partially bind it in the implementation map).
sourceraw docstring

current-user-has-partial-permissions?clj

(current-user-has-partial-permissions? perms-set)
(current-user-has-partial-permissions? read-or-write object)
(current-user-has-partial-permissions? read-or-write entity object-id)

Implementation of can-read?/can-write? for the old permissions system. true if the current user has partial permissions for the paths returned by its implementation of perms-objects-set. (READ-OR-WRITE is either :read or :write and passed to perms-objects-set; you'll usually want to partially bind it in the implementation map).

Implementation of `can-read?`/`can-write?` for the old permissions system. `true` if the current user has *partial*
permissions for the paths returned by its implementation of `perms-objects-set`. (READ-OR-WRITE is either `:read` or
`:write` and passed to `perms-objects-set`; you'll usually want to partially bind it in the implementation map).
sourceraw docstring

decompressclj

(decompress compressed-bytes)

Decompress COMPRESSED-BYTES.

Decompress COMPRESSED-BYTES.
sourceraw docstring

IObjectPermissionscljprotocol

Methods for determining whether the current user has read/write permissions for a given object.

Methods for determining whether the current user has read/write permissions for a given object.

can-create?clj

(can-create? entity m)

NEW! Check whether or not current user is allowed to CREATE a new instance of entity with properties in map m.

Because this method was added YEARS after can-read? and can-write?, most models do not have an implementation for this method, and instead POST API endpoints themselves contain the appropriate permissions logic (ick). Implement this method as you come across models that are missing it.

NEW! Check whether or not current user is allowed to CREATE a new instance of `entity` with properties in map
`m`.

Because this method was added YEARS after `can-read?` and `can-write?`, most models do not have an implementation
for this method, and instead `POST` API endpoints themselves contain the appropriate permissions logic (ick).
Implement this method as you come across models that are missing it.

can-read?clj

(can-read? instance)
(can-read? entity id)

Return whether *current-user* has read permissions for an object. You should use one of these implmentations:

  • (constantly true)
  • superuser?
  • (partial current-user-has-full-permissions? :read) (you must also implement perms-objects-set to use this)
  • (partial current-user-has-partial-permissions? :read) (you must also implement perms-objects-set to use this)
Return whether `*current-user*` has *read* permissions for an object. You should use one of these implmentations:

*  `(constantly true)`
*  `superuser?`
*  `(partial current-user-has-full-permissions? :read)` (you must also implement `perms-objects-set` to use this)
*  `(partial current-user-has-partial-permissions? :read)` (you must also implement `perms-objects-set` to use
   this)

can-write?clj

(can-write? instance)
(can-write? entity id)

Return whether *current-user* has write permissions for an object. You should use one of these implmentations:

  • (constantly true)
  • superuser?
  • (partial current-user-has-full-permissions? :write) (you must also implement perms-objects-set to use this)
  • (partial current-user-has-partial-permissions? :write) (you must also implement perms-objects-set to use this)
Return whether `*current-user*` has *write* permissions for an object. You should use one of these implmentations:

*  `(constantly true)`
*  `superuser?`
*  `(partial current-user-has-full-permissions? :write)` (you must also implement `perms-objects-set` to use this)
*  `(partial current-user-has-partial-permissions? :write)` (you must also implement `perms-objects-set` to use
   this)

perms-objects-setclj

(perms-objects-set this read-or-write)

Return a set of permissions object paths that a user must have access to in order to access this object. This should be something like #{"/db/1/schema/public/table/20/"}. READ-OR-WRITE will be either :read or :write, depending on which permissions set we're fetching (these will be the same sets for most models; they can ignore this param).

Return a set of permissions object paths that a user must have access to in order to access this object. This
should be something like #{"/db/1/schema/public/table/20/"}. READ-OR-WRITE will be either `:read` or `:write`,
depending on which permissions set we're fetching (these will be the same sets for most models; they can ignore
this param).
sourceraw docstring

IObjectPermissionsDefaultsclj

Default implementations for IObjectPermissions.

Default implementations for `IObjectPermissions`.
sourceraw docstring

json-inclj

(json-in obj)

Default in function for columns given a Toucan type :json. Serializes object as JSON.

Default in function for columns given a Toucan type `:json`. Serializes object as JSON.
sourceraw docstring

json-out-with-keywordizationclj

(json-out-with-keywordization obj)

Default out function for columns given a Toucan type :json. Parses serialized JSON string and keywordizes keys.

Default out function for columns given a Toucan type `:json`. Parses serialized JSON string and keywordizes keys.
sourceraw docstring

json-out-without-keywordizationclj

(json-out-without-keywordization obj)

Out function for columns given a Toucan type :json-no-keywordization. Similar to :json-out but does leaves keys as strings.

Out function for columns given a Toucan type `:json-no-keywordization`. Similar to `:json-out` but does leaves keys
as strings.
sourceraw docstring

superuser?clj

(superuser? & _)

Is *current-user* is a superuser? Ignores args. Intended for use as an implementation of can-read? and/or can-write?.

Is `*current-user*` is a superuser? Ignores args.
Intended for use as an implementation of `can-read?` and/or `can-write?`.
sourceraw docstring

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

× close