@smartkomm/plexus-cli 0.1.18 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 1ed05b1d6d3b3105aed99411f816d92886682495715074569f573f8bb958f142
1
+ 6bd1848e1a792dacbfc29a58eb3516ad4e8a34841abd0d93ff155b2f32fc858a
@@ -118,7 +118,8 @@ try: creating, onboarding or wiping a tenant (`config wipe`, `config prune-offer
118
118
  the `branding …` and `files put|delete` commands (a school sets its branding and
119
119
  library files through `config apply` or in the app), issuing a token for someone
120
120
  else (`tokens create --for`), every `users` command except `users groups`
121
- (the school changes memberships in the app or through `foundation.users`), the mail
121
+ (the school manages its own people with `tenant-users …` and changes memberships in
122
+ the app or through `foundation.users`), the mail
122
123
  delivery monitor (`notifications list|show|retry|self-test`), Stripe Connect and
123
124
  e-signature connections, contract resolvers (contract logic is platform code),
124
125
  retention runs, feedback triage, worker jobs and migrations. A command without
@@ -233,6 +234,7 @@ whole is the operator's (ask them; do not try).
233
234
  | [users/change-login-email.md](references/users/change-login-email.md) | Plattform | Change an account's sign-in address. |
234
235
  | [users/cli-access-for-tenant-admin.md](references/users/cli-access-for-tenant-admin.md) | Mandant + Plattform | Give a school's administrator a CLI token for exactly their tenant (minting it themselves suffices; issuing it for them with `tokens create --for` needs the operator). |
235
236
  | [users/delete-permission-group.md](references/users/delete-permission-group.md) | Mandant | Delete an orphaned permission group. |
237
+ | [users/manage-school-users.md](references/users/manage-school-users.md) | Mandant | List, invite, deactivate (with handover), archive and reactivate the school's users; send a sign-in or password-reset link, switch their mail categories, ask for a signature (`tenant-users …`). |
236
238
  | [users/grant-cross-tenant-access.md](references/users/grant-cross-tenant-access.md) | Plattform | Give every user of every tenant access to the test tenant. |
237
239
  | [users/grant-feedback-assignable.md](references/users/grant-feedback-assignable.md) | Plattform | Make a platform admin assignable for feedback. |
238
240
  | [users/set-password.md](references/users/set-password.md) | Plattform | Set or regenerate an existing user's password. |
@@ -1,7 +1,7 @@
1
1
  # plexus-cli command reference
2
2
 
3
3
  Generated from the commands the CLI registers — do not edit; `plexus-cli <command> --help` prints the same.
4
- 276 commands. Every network command also takes `--env <local|staging|prod>`, `--tenant <slug>`,
4
+ 289 commands. Every network command also takes `--env <local|staging|prod>`, `--tenant <slug>`,
5
5
  `--json` (raw JSON instead of a table) and `--allow-prod` (required for a writing run against production).
6
6
 
7
7
  - [Admission](#admission) (15)
@@ -26,6 +26,7 @@ Generated from the commands the CLI registers — do not edit; `plexus-cli <comm
26
26
  - [Signing](#signing) (13)
27
27
  - [Stammdaten](#stammdaten) (2)
28
28
  - [Stripe](#stripe) (3)
29
+ - [Tenant users](#tenant-users) (13)
29
30
  - [Users](#users) (20)
30
31
  - [Work-Items](#work-items) (5)
31
32
 
@@ -3146,6 +3147,116 @@ What each Träger's Stripe connection can do — `status` is the one the staff p
3146
3147
 
3147
3148
  - **Effect:** read — changes nothing on the deployment
3148
3149
 
3150
+ ## Tenant users
3151
+
3152
+ ### `tenant-users archive <email|userId>`
3153
+
3154
+ Archive a user in this school (groups removed, hidden from lists and pickers) — plan unless --confirm.
3155
+
3156
+ - **Effect:** plan by default — writes only with `--confirm` (and `--env`; on production also `--allow-prod`)
3157
+
3158
+ | Option | Description |
3159
+ |---|---|
3160
+ | `--successor <value>` | Who takes over their open applications and tasks (email or account id) — required while they hold any; the dry run lists the candidates. |
3161
+ | `--confirm` | Write (without it, only the handover plan is printed). |
3162
+
3163
+ ### `tenant-users deactivate <email|userId>`
3164
+
3165
+ Deactivate a user in this school (reversible, groups kept but without effect, API tokens revoked) — plan unless --confirm.
3166
+
3167
+ - **Effect:** plan by default — writes only with `--confirm` (and `--env`; on production also `--allow-prod`)
3168
+
3169
+ | Option | Description |
3170
+ |---|---|
3171
+ | `--successor <value>` | Who takes over their open applications and tasks (email or account id) — required while they hold any; the dry run lists the candidates. |
3172
+ | `--confirm` | Write (without it, only the handover plan is printed). |
3173
+
3174
+ ### `tenant-users groups list`
3175
+
3176
+ List the school's staff groups — the options of `tenant-users list --group` and `tenant-users invite --group`.
3177
+
3178
+ - **Effect:** read — changes nothing on the deployment
3179
+
3180
+ ### `tenant-users history <email|userId>`
3181
+
3182
+ The Verlauf of one user in the school: who changed what, newest first.
3183
+
3184
+ - **Effect:** read — changes nothing on the deployment
3185
+
3186
+ ### `tenant-users invite`
3187
+
3188
+ Invite a new member of staff to this school: account, access and a one-time sign-in link by mail — plan unless --confirm.
3189
+
3190
+ - **Effect:** plan by default — writes only with `--confirm` (and `--env`; on production also `--allow-prod`)
3191
+
3192
+ | Option | Description |
3193
+ |---|---|
3194
+ | `--first-name <value>` (required) | The person's first name. |
3195
+ | `--last-name <value>` (required) | The person's last name. |
3196
+ | `--email <value>` (required) | The sign-in address; the link goes there. |
3197
+ | `--language <value>` (required) | de or en — the letters' language of a new account. |
3198
+ | `--group <value>` | A staff group, by key, id or exact label (`tenant-users groups list`); needs administration.permissions.manage. |
3199
+ | `--unit <value>` | The group's unit, by config key or id (`org tree`); only with --group. Resolving it reads the organisation tree (administration.organizationStructure.manage). |
3200
+ | `--confirm` | Write and mail (without it, only the plan is printed). |
3201
+
3202
+ ### `tenant-users list`
3203
+
3204
+ List the school's users (Administration → Nutzer); archived ones only with --status archived.
3205
+
3206
+ - **Effect:** read — changes nothing on the deployment
3207
+
3208
+ | Option | Description |
3209
+ |---|---|
3210
+ | `--status <value>` | active, deactivated, archived or invited (active, never signed in). |
3211
+ | `--group <value>` | A staff group, by id or exact label (`tenant-users groups list`). |
3212
+ | `--search <value>` | Part of a name or address. |
3213
+
3214
+ ### `tenant-users notifications list <email|userId>`
3215
+
3216
+ A user's personal mail categories in this school and what an internal letter of each does today.
3217
+
3218
+ - **Effect:** read — changes nothing on the deployment
3219
+
3220
+ ### `tenant-users notifications set <email|userId>`
3221
+
3222
+ Switch a user's personal mail categories in this school (the person is told by mail; the latest change, theirs or yours, holds).
3223
+
3224
+ - **Effect:** write — needs `--env`; on production also `--allow-prod`
3225
+
3226
+ | Option | Description |
3227
+ |---|---|
3228
+ | `--set <value>` (required) | <category>=on\|off (repeatable). |
3229
+
3230
+ ### `tenant-users reactivate <email|userId>`
3231
+
3232
+ Reactivate a deactivated or archived user in this school (an archived one starts without groups).
3233
+
3234
+ - **Effect:** write — needs `--env`; on production also `--allow-prod`
3235
+
3236
+ ### `tenant-users send-login-link <email|userId>`
3237
+
3238
+ Mail a user of this school a fresh one-time sign-in link (active users only) — e.g. an invitation that expired.
3239
+
3240
+ - **Effect:** write — needs `--env`; on production also `--allow-prod`
3241
+
3242
+ ### `tenant-users send-password-reset <email|userId>`
3243
+
3244
+ Mail a user of this school a password-reset link (active users only); only the person sets the new password.
3245
+
3246
+ - **Effect:** write — needs `--env`; on production also `--allow-prod`
3247
+
3248
+ ### `tenant-users show <email|userId>`
3249
+
3250
+ Show one user of the school: status, groups, last sign-in, whether a signature is stored.
3251
+
3252
+ - **Effect:** read — changes nothing on the deployment
3253
+
3254
+ ### `tenant-users signature request <email|userId>`
3255
+
3256
+ Ask a user by mail to store their own signature — only while none is stored, at most once a day.
3257
+
3258
+ - **Effect:** write — needs `--env`; on production also `--allow-prod`
3259
+
3149
3260
  ## Users
3150
3261
 
3151
3262
  ### `accounts email-changes`
@@ -2,7 +2,8 @@
2
2
 
3
3
  **When to use:** a school's own administrator (no platform rights) should run
4
4
  `plexus-cli` for **exactly their tenant**: export, plan and apply its config
5
- (`config export|apply|set`) and its admission offers (`offer …`). Example: the
5
+ (`config export|apply|set`), its admission offers (`offer …`) and its users
6
+ (`tenant-users …`, needs `administration.users.manage`). Example: the
6
7
  administrator of one school group onboarding their own offers.
7
8
 
8
9
  The person gets a `plx_…` token that acts **as them**. It reaches exactly the
@@ -114,4 +115,5 @@ platform`, setup mode (Load N / wipe), `offer delete` (the hard delete).
114
115
 
115
116
  ## Related
116
117
  - [Add a tenant admin](./add-tenant-admin.md) — the login itself.
118
+ - [Manage a school's users](./manage-school-users.md) — what the token does for the school's people.
117
119
  - [Edit a live tenant's offer](../offer/edit-live-tenant-offer.md).
@@ -0,0 +1,133 @@
1
+ # Manage a school's users
2
+
3
+ **When to use:** a school's administrator looks after the people of **their own
4
+ school** from the shell — who is there and in which status, deactivate someone
5
+ who leaves (handing their open work to a colleague), bring them back, invite a
6
+ new person, send a sign-in or password-reset link, switch their personal mail
7
+ categories, ask them to store their signature. The same as *Administration →
8
+ Nutzer* in the app, with the same rules and the same Verlauf.
9
+
10
+ A **school's token suffices**: every `tenant-users` command asks for
11
+ `administration.users.manage` in the school (the `tenant_admin` group holds it);
12
+ a platform operator passes with `_platform.users.manage`. The `users …` command
13
+ group is the platform's cross-school surface and needs a platform operator.
14
+
15
+ ## Prerequisites
16
+ - A `plx_…` token for your own account and `default_tenant` (or `--tenant <slug>`)
17
+ set — see [CLI access for a tenant admin](./cli-access-for-tenant-admin.md).
18
+ - `--env` is required for every write; prod also needs `--allow-prod`.
19
+ - A person is named by their **sign-in address** or **account id** — never by name.
20
+ An address must name exactly one account in the school, or the command refuses.
21
+
22
+ ## Steps
23
+
24
+ **1 — see the school's users:**
25
+
26
+ ```bash
27
+ plexus-cli --env <env> --tenant <slug> tenant-users list # active + deactivated
28
+ plexus-cli --env <env> --tenant <slug> tenant-users list --status invited # active, never signed in
29
+ plexus-cli --env <env> --tenant <slug> tenant-users list --status archived
30
+ plexus-cli --env <env> --tenant <slug> tenant-users groups list # labels/ids for --group
31
+ plexus-cli --env <env> --tenant <slug> tenant-users list --group "<label>" --search <part>
32
+ plexus-cli --env <env> --tenant <slug> tenant-users show <email>
33
+ ```
34
+
35
+ **2 — deactivate someone, with a handover.** Without `--confirm` the command only
36
+ prints what would move (applications and tasks to the successor, team tasks back
37
+ to the queue) and who may take over:
38
+
39
+ ```bash
40
+ plexus-cli --env <env> --tenant <slug> tenant-users deactivate <email>
41
+ plexus-cli --env <env> --tenant <slug> tenant-users deactivate <email> --successor <colleague-email> --confirm
42
+ ```
43
+
44
+ - Deactivating is reversible: the groups stay, but give no rights; the person's
45
+ API tokens are revoked and do not come back.
46
+ - Archiving works the same way (plan, then `--confirm`), but also removes the
47
+ person's groups and hides them from lists and pickers:
48
+
49
+ ```bash
50
+ plexus-cli --env <env> --tenant <slug> tenant-users archive <email> --successor <colleague-email> --confirm
51
+ ```
52
+ - A published responsibility rule that names the person refuses either change
53
+ until the rule names someone else (workflow editor: „Person ersetzen", then
54
+ publish) — the plan prints that refusal word for word.
55
+
56
+ **3 — bring someone back:**
57
+
58
+ ```bash
59
+ plexus-cli --env <env> --tenant <slug> tenant-users reactivate <email>
60
+ ```
61
+
62
+ A deactivated person gets their groups back at once; an archived one starts
63
+ without groups — assign them in the app (needs `administration.permissions.manage`).
64
+
65
+ **4 — invite a new person.** Without `--confirm` the command only prints whom it
66
+ would invite, in which group and unit; with it, the account and the access are
67
+ created and a one-time sign-in link is mailed — always, there is no invitation
68
+ without one, and nobody sets a password for them:
69
+
70
+ ```bash
71
+ plexus-cli --env <env> --tenant <slug> tenant-users groups list # label, key, id
72
+ plexus-cli --env <env> --tenant <slug> tenant-users invite --first-name <first> --last-name <last> --email <email> --language de --group <key>
73
+ plexus-cli --env <env> --tenant <slug> tenant-users invite --first-name <first> --last-name <last> --email <email> --language de --group <key> --confirm
74
+ ```
75
+
76
+ - `--group` takes the key, the id or the exact label; `--unit <key>` (from
77
+ `org tree`) only together with `--group` — naming a unit reads the
78
+ organisation tree, which needs `administration.organizationStructure.manage`. Giving a group needs
79
+ `administration.permissions.manage` as well — without it, invite without
80
+ `--group` and let someone who has it assign the group in the app.
81
+ - `--language` (`de` or `en`) is the language of the letters for a **new**
82
+ account; someone who already works at another school keeps their own.
83
+ - The backend refuses, and the command prints the refusal as it is: an address
84
+ that already has an access in this school (bring them back with `reactivate`
85
+ instead), and an address that cannot be invited as staff (for example a
86
+ family's account).
87
+
88
+ **5 — send a sign-in link or a password-reset link** (active users only):
89
+
90
+ ```bash
91
+ plexus-cli --env <env> --tenant <slug> tenant-users send-login-link <email> # e.g. the invitation's link expired
92
+ plexus-cli --env <env> --tenant <slug> tenant-users send-password-reset <email> # they set the new password themselves
93
+ ```
94
+
95
+ Both go out at every mail level; a deactivated or archived user gets neither —
96
+ `reactivate` first.
97
+
98
+ **6 — switch their personal mail categories:**
99
+
100
+ ```bash
101
+ plexus-cli --env <env> --tenant <slug> tenant-users notifications list <email>
102
+ plexus-cli --env <env> --tenant <slug> tenant-users notifications set <email> --set <category>=off --set <category>=on
103
+ ```
104
+
105
+ The person is told by mail; they can switch it back themselves, and the latest
106
+ change holds. Sign-in and security mail cannot be switched off.
107
+
108
+ **7 — ask for their signature** (only while none is stored, at most once a day):
109
+
110
+ ```bash
111
+ plexus-cli --env <env> --tenant <slug> tenant-users signature request <email>
112
+ ```
113
+
114
+ Only the person can store, replace or remove their own signature.
115
+
116
+ ## Verify
117
+
118
+ ```bash
119
+ plexus-cli --env <env> --tenant <slug> tenant-users show <email> # status, groups, signature yes/no
120
+ plexus-cli --env <env> --tenant <slug> tenant-users history <email> # one Verlauf row per change
121
+ ```
122
+
123
+ ## Idempotency / gotchas
124
+ - Every change writes one Verlauf row; a mail switch that changes nothing writes none.
125
+ - Nobody changes their own status, and the last active user who may manage users
126
+ cannot be deactivated or archived — the backend refuses with the reason.
127
+ - `--successor` must be someone who may take over (listed under *candidates* in the
128
+ plan); the backend checks it on `--confirm`.
129
+ - `--json` prints the raw rows for scripts.
130
+
131
+ ## Related
132
+ - [CLI access for a tenant admin](./cli-access-for-tenant-admin.md) — the token.
133
+ - [Change, test and publish a responsibility rule](../offer/assignment-rule.md) — replace a person a rule names.