Liking cljdoc? Tell your friends :D

wagoe.platform.core.authorization

The permission registry, built from what modules declare (ADR-041 §1–2).

A module contributes under :authorization:

{:permissions {:orders/refund {:label "Refund orders"}} :roles {:orders/viewer {:description "…" :permissions #{:orders/read}}} :scopes {:domain-id {:label "Domain" :entity :domains}} :scope-sources {:user/department {:label "The member's department" :resolve (fn [user] #{7})}}}

<module>/read and <module>/write exist for every module without being declared, and so do the code roles <module>/viewer and <module>/editor holding them, unless the module declares its own. What a scope means is ADR-041 §4, core.scope.

The permission registry, built from what modules declare (ADR-041 §1–2).

A module contributes under `:authorization`:

  {:permissions {:orders/refund {:label "Refund orders"}}
   :roles       {:orders/viewer {:description "…" :permissions #{:orders/read}}}
   :scopes      {:domain-id {:label "Domain" :entity :domains}}
   :scope-sources {:user/department {:label   "The member's department"
                                     :resolve (fn [user] #{7})}}}

`<module>/read` and `<module>/write` exist for every module without being
declared, and so do the code roles `<module>/viewer` and `<module>/editor`
holding them, unless the module declares its own. What a scope means is
ADR-041 §4, `core.scope`.
raw docstring

admin-permission?clj

(admin-permission? p)

Whether p is one of the admin's, admin.<entity>/....

Whether `p` is one of the admin's, `admin.<entity>/...`.
sourceraw docstring

build-registryclj

(build-registry declarations)

One registry from declarations, {module-key declaration} for every enabled module, a declaration being nil when the module declares nothing.

{:permissions {..} :roles {..} :scopes {..} :scope-sources {..}}, each entry tagged with its :module, or {:error {:type :configuration-error …}}. A permission two modules declare is an error, except that a declared one stands over a derived one, and either over any other source. A scope key declared twice must be declared the same, or once from another source.

One registry from `declarations`, {module-key declaration} for every enabled
module, a declaration being nil when the module declares nothing.

{:permissions {..} :roles {..} :scopes {..} :scope-sources {..}}, each
entry tagged with its `:module`, or {:error {:type :configuration-error …}}.
A permission two modules declare is an error, except that a declared one
stands over a derived one, and either over any other source. A scope key
declared twice must be declared the same, or once from another source.
sourceraw docstring

Declarationclj

What a module contributes under :authorization. A permission's or scope key's :source is :declared unless it says otherwise.

A scope key may name its value's :schema, the :sources its value may be taken from, and :expand, a fn from values to them and everything beneath.

What a module contributes under `:authorization`. A permission's or scope
key's `:source` is `:declared` unless it says otherwise.

A scope key may name its value's `:schema`, the `:sources` its value may be
taken from, and `:expand`, a fn from values to them and everything beneath.
sourceraw docstring

derived-rolesclj

(derived-roles ns)

<ns>/viewer and <ns>/editor, over <ns>/read and <ns>/write.

`<ns>/viewer` and `<ns>/editor`, over `<ns>/read` and `<ns>/write`.
sourceraw docstring

format-route-reportclj

(format-route-report mode report)

report (route-report) as text for a terminal: the endpoints no rule covers first, then every endpoint with its rule and permission.

`report` (`route-report`) as text for a terminal: the endpoints no rule
covers first, then every endpoint with its rule and permission.
sourceraw docstring

invalid-route-markersclj

(invalid-route-markers routes)

The :authorization values in routes other than :signed-in and :self, as [{:path :authorization}]. Like :permission.

The `:authorization` values in `routes` other than `:signed-in` and
`:self`, as [{:path :authorization}]. Like `:permission`.
sourceraw docstring

invalid-route-scopesclj

(invalid-route-scopes scopes routes)

The :scopes in routes that core.scope/route-scope? refuses for the registry's scopes, or that name a path parameter the route lacks, as [{:path :scope}]. Like :permission.

The `:scope`s in `routes` that `core.scope/route-scope?` refuses for the
registry's `scopes`, or that name a path parameter the route lacks, as
[{:path :scope}]. Like `:permission`.
sourceraw docstring

modesclj

What :wagoe/authorization :mode may say: :off checks nothing, :report logs what :enforce would refuse, :enforce refuses it.

What `:wagoe/authorization :mode` may say: `:off` checks nothing, `:report`
logs what `:enforce` would refuse, `:enforce` refuses it.
sourceraw docstring

read-write-permissionsclj

(read-write-permissions ns noun)

<ns>/read and <ns>/write, derived, labelled with noun.

`<ns>/read` and `<ns>/write`, derived, labelled with `noun`.
sourceraw docstring

required-permissionclj

(required-permission {:keys [rule permission module]} method)

The permission rule asks of a method request: its own, or the module's <module>/read for GET and HEAD and <module>/write otherwise. Nil for a rule that asks none.

The permission `rule` asks of a `method` request: its own, or the module's
`<module>/read` for GET and HEAD and `<module>/write` otherwise. Nil for a
rule that asks none.
sourceraw docstring

route-reportclj

(route-report routes)

Every endpoint of routes, a router's flattened [path data] pairs, with the rule it falls under, as [{:path :method :rule :permissions :scope}]. :permissions holds what the rule asks, both read and write for a module route answering :any method. A redirect carries :redirect-to: the target's rule is the one that applies.

Every endpoint of `routes`, a router's flattened [path data] pairs, with the
rule it falls under, as [{:path :method :rule :permissions :scope}].
`:permissions` holds what the rule asks, both read and write for a module
route answering `:any` method. A redirect carries `:redirect-to`: the
target's rule is the one that applies.
sourceraw docstring

route-ruleclj

(route-rule data)

The rule merged endpoint data falls under, first match wins:

  • :public true: {:rule :public}, nothing checked.
  • :authorization :signed-in: {:rule :signed-in}, any signed-in user.
  • :authorization :self: {:rule :self}, the handler checks.
  • :permission p: {:rule :permission :permission p}.
  • :wagoe/module m: {:rule :module :module m}, its read or write.
  • otherwise {:rule :none}: refused.
The rule merged endpoint `data` falls under, first match wins:

- `:public true`: `{:rule :public}`, nothing checked.
- `:authorization :signed-in`: `{:rule :signed-in}`, any signed-in user.
- `:authorization :self`: `{:rule :self}`, the handler checks.
- `:permission p`: `{:rule :permission :permission p}`.
- `:wagoe/module m`: `{:rule :module :module m}`, its read or write.
- otherwise `{:rule :none}`: refused.
sourceraw docstring

unchecked-route-scopesclj

(unchecked-route-scopes routes)

The endpoints of routes that say a :scope under a rule that checks none, :public, :signed-in or :self, as [{:path :method :scope}]: the scope would be ignored and :wagoe/scopes never set.

The endpoints of `routes` that say a `:scope` under a rule that checks
none, `:public`, `:signed-in` or `:self`, as [{:path :method :scope}]: the
scope would be ignored and `:wagoe/scopes` never set.
sourceraw docstring

unknown-route-permissionsclj

(unknown-route-permissions permissions routes)

The :permissions in routes, a router's flattened [path data] pairs, that permissions (the registry's map) does not hold, as [{:path :permission}]. A :permission may sit in the route data or in a method's.

The `:permission`s in `routes`, a router's flattened [path data] pairs, that
`permissions` (the registry's map) does not hold, as [{:path :permission}].
A `:permission` may sit in the route data or in a method's.
sourceraw docstring

unruled-routesclj

(unruled-routes routes)

The endpoints of routes that no rule covers, as [{:path :methods}]: what :enforce refuses to everyone but a platform admin.

The endpoints of `routes` that no rule covers, as [{:path :methods}]: what
`:enforce` refuses to everyone but a platform admin.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close