IUserGroupService: groups, members, roles and assignments through one place, so each change is checked and audited. Reads go to the database every time.
IUserGroupService: groups, members, roles and assignments through one place, so each change is checked and audited. Reads go to the database every time.
(active-users user-repository xf)Every active user, by email, through xf, read a page at a time so only
what xf keeps is held; of the bound tenant, when one is.
Every active user, by email, through `xf`, read a page at a time so only what `xf` keeps is held; of the bound tenant, when one is.
(create-group-service group-repository
user-repository
audit-repository
settings)(create-group-service group-repository
user-repository
audit-repository
settings
{:keys [registry membership explain resolve]})A group service. settings is what prepare-settings returns. opts:
:registry, the permission registry its code roles come from, and
:membership, the hook (fn [user] #{group-name …}) that adds groups an
identity provider names, and :explain and :resolve,
wagoe.platform.shell.authorization/explain and resolve-rights with the
registry applied.
A group service. `settings` is what `prepare-settings` returns. `opts`:
`:registry`, the permission registry its code roles come from, and
`:membership`, the hook `(fn [user] #{group-name …})` that adds groups an
identity provider names, and `:explain` and `:resolve`,
`wagoe.platform.shell.authorization/explain` and `resolve-rights` with the
registry applied.(declared-permissions {:keys [permissions]})The :permissions enum of prepared groups settings, as a declaration for
the permission registry. A schema that is not an enum lists nothing. Read
until 2.0, when modules declare their own.
The `:permissions` enum of prepared `groups` settings, as a declaration for the permission registry. A schema that is not an enum lists nothing. Read until 2.0, when modules declare their own.
(declared-scopes {:keys [scope-schema]})The keys of a :scope map schema in prepared groups settings, as scope
keys for the permission registry, :wagoe/entity read as :entity.
Another schema declares none. Read until 2.0, like :permissions.
The keys of a `:scope` map schema in prepared `groups` settings, as scope keys for the permission registry, `:wagoe/entity` read as `:entity`. Another schema declares none. Read until 2.0, like `:permissions`.
(ends-memberships? svc)Whether svc can end a membership on a day (BOU-1001).
Whether `svc` can end a membership on a day (BOU-1001).
(ensure-everyone! {:keys [group-repository]})Make the bound tenant's Everyone if it has none, as group-routes does
before a page shows it. Another request making it first is fine.
Make the bound tenant's Everyone if it has none, as `group-routes` does before a page shows it. Another request making it first is fine.
(in-tenant svc tenant-id f)Call f in tenant-id's groups and roles, its Everyone made first, as
the group pages read them: until then the no-tenant one stands in, which
reads miss.
Call `f` in `tenant-id`'s groups and roles, its Everyone made first, as the group pages read them: until then the no-tenant one stands in, which reads miss.
(memoized-membership svc)svc asking the membership hook once per user: for a page or a set of
previews that changes nothing.
`svc` asking the membership hook once per user: for a page or a set of previews that changes nothing.
(migrate! {:keys [group-repository registry] :as svc})ADR-041's migration: under :enforce nobody may do less than under :off, and nobody becomes an admin. Idempotent; runs at boot.
The first time, Everyone is created and, when there are users other than
admins, given every module's editor role. Viewers join Readers. Group
grants become assignments of a managed role named after their permission.
migration-plan decides each, so what wagoe upgrade authorization check
prints is what runs.
ADR-041's migration: under :enforce nobody may do less than under :off, and nobody becomes an admin. Idempotent; runs at boot. The first time, Everyone is created and, when there are users other than admins, given every module's editor role. Viewers join Readers. Group grants become assignments of a managed role named after their permission. `migration-plan` decides each, so what `wagoe upgrade authorization check` prints is what runs.
(migration-plan {:keys [group-repository registry settings]})What migrate! changes, read without writing: {:everyone-roles (nil when
Everyone exists or only admins do) :viewers [user-id] :readers-roles
:grants [legacy grant not yet migrated]}, but not one named after a code
role: that stays unmigrated, and migrate! logs it. Neither group gets a
role holding a permission something already checks as a grant
(gated-permissions): that would hand it to every user.
What `migrate!` changes, read without writing: {:everyone-roles (nil when
Everyone exists or only admins do) :viewers [user-id] :readers-roles
:grants [legacy grant not yet migrated]}, but not one named after a code
role: that stays unmigrated, and `migrate!` logs it. Neither group gets a
role holding a permission something already checks as a grant
(`gated-permissions`): that would hand it to every user.(offer svc option change)option with the preview of change, or with :refused, the refusal's
ex-data, when the change would be refused: one bad option leaves the rest.
`option` with the preview of `change`, or with :refused, the refusal's ex-data, when the change would be refused: one bad option leaves the rest.
(prepare-settings groups):wagoe/user :groups checked and resolved, for the service. Throws
:configuration-error, so a bad declaration fails boot.
`:wagoe/user :groups` checked and resolved, for the service. Throws :configuration-error, so a bad declaration fails boot.
(provider-group-names {:keys [membership user-repository]} user)The group names the membership hook gives user.
The group names the membership hook gives `user`.
(registry-permissions svc)The permissions the registry declares, {permission {:label :module}}.
The permissions the registry declares, {permission {:label :module}}.
(rights-timeline read per-action? {:keys [id created-at tenant-id]} n)The newest n changes to user's rights, as audit-core/rights-timeline
gives them, Everyone's since the user was created, filed under the group,
included (BOU-862). (read actions opts) gives the audit entries of
actions matching find-audit-logs opts; when per-action? it reads
one action at a time.
The newest `n` changes to `user`'s rights, as `audit-core/rights-timeline` gives them, Everyone's since the user was created, filed under the group, included (BOU-862). `(read actions opts)` gives the audit entries of `actions` matching find-audit-logs `opts`; when `per-action?` it reads one action at a time.
(tenant-groups? svc)Whether svc's repository keeps groups per tenant; one written before
BOU-996 does not, and its pages stay a platform admin's.
Whether `svc`'s repository keeps groups per tenant; one written before BOU-996 does not, and its pages stay a platform admin's.
(with-registry-permissions settings registry)settings checking a grant's permission against registry when
:groups :permissions declares none. Without either, any keyword passes.
`settings` checking a grant's permission against `registry` when `:groups :permissions` declares none. Without either, any keyword passes.
(with-registry-scopes settings registry)settings checking a grant's scope against the scope keys in registry
(wagoe.platform.core.scope/scope-schema) when it declares any; else
against the :groups :scope schema, or any map, as before.
`settings` checking a grant's scope against the scope keys in `registry` (`wagoe.platform.core.scope/scope-schema`) when it declares any; else against the `:groups :scope` schema, or any map, as before.
(with-roles svc)svc reading every role once, for a page of previews and grant options
that changes nothing. A group service of another kind is returned as it is.
`svc` reading every role once, for a page of previews and grant options that changes nothing. A group service of another kind is returned as it is.
(with-tenant tenant-id f)Call f with the group service and repository working in tenant
tenant-id's groups and roles, nil for none (BOU-996).
Call `f` with the group service and repository working in tenant `tenant-id`'s groups and roles, nil for none (BOU-996).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |