@jwilleke/ngdpbase-types 5.32.0 → 5.33.0

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.
@@ -4,6 +4,8 @@ import type { Role, RoleUpdate } from '../types/Role.js';
4
4
  import type { RoleProvider } from '../types/RoleProvider.js';
5
5
  import { type ActorContext } from '../context/ActorContext.js';
6
6
  import type { JobContext } from '../context/JobContext.js';
7
+ /** The title of the one notification for contacts found holding roles at start-up (#2040). */
8
+ export declare const CONTACT_MEMBERS_TITLE = "Contacts are listed as role members";
7
9
  declare class RoleManager extends BaseManager {
8
10
  readonly description = "Canonical OrganizationRole records (#617 follow-up)";
9
11
  private provider;
@@ -142,6 +144,11 @@ declare class RoleManager extends BaseManager {
142
144
  * IdentityManager joins an account to an existing person, the roles the
143
145
  * account's person held go with the account. Returns how many records
144
146
  * changed. IdentityManager's join records the change. All or nothing (#2015).
147
+ *
148
+ * #2040: the roles go only with credentials. The join gives the account
149
+ * (`fromPersonId`'s credentials) to `toPersonId`, which is still a contact
150
+ * while the roles move, so the check is that `fromPersonId` is a user: a
151
+ * contact's memberships never move to anyone.
145
152
  */
146
153
  moveMemberships(fromPersonId: string, toPersonId: string): Promise<number>;
147
154
  /**
@@ -160,7 +167,12 @@ declare class RoleManager extends BaseManager {
160
167
  * be left without the role it was given, nor keep one it was meant to lose.
161
168
  */
162
169
  private membershipTarget;
163
- /** One member change and its inverse. */
170
+ /**
171
+ * One member change and its inverse. An add is checked: the member must be a
172
+ * user (#2040), judged by `credentialsOf` when the credentials come from
173
+ * another identity in the same change (a join). An undo puts back what was
174
+ * there and is not checked.
175
+ */
164
176
  private memberChange;
165
177
  /**
166
178
  * Make each change in turn (#2015). When one fails, undo the ones made, in
@@ -186,6 +198,11 @@ declare class RoleManager extends BaseManager {
186
198
  * record is created in `createIn` for an add; with no `createIn` an add to a
187
199
  * missing record throws, and a removal from one changes nothing. False,
188
200
  * writing nothing, when the person already is (or is not) a member.
201
+ *
202
+ * `mustBeUser` (#2040): the identity whose credentials an add needs, or null
203
+ * for an undo, which puts back what was there. Only a user holds a role; a
204
+ * contact is refused with {@link RoleMemberRefusal} before anything is
205
+ * written, the role record included.
189
206
  */
190
207
  private setMember;
191
208
  /** assignRole / removeRole: the change, recorded as a user-edit whether it happened or not (#1204, #2015). */
@@ -199,6 +216,31 @@ declare class RoleManager extends BaseManager {
199
216
  * permits is the policies, resolved at the moment of each decision.
200
217
  */
201
218
  private getOrCreateRoleRecord;
219
+ /**
220
+ * Why the identity `personId` may not hold a role, or null when it may
221
+ * (#2040). Only a user holds a role: an identity with credentials, whose
222
+ * identity record's `identifier` is the username of an account that exists.
223
+ * A contact's identifier is `person:<uuid>` and it has no account.
224
+ * Read under the system context: this is RoleManager's own rule.
225
+ */
226
+ private notAUserReason;
227
+ /**
228
+ * Check the role records for members that are contacts (#2040), once at
229
+ * start-up when every manager is up. Nothing is dropped or rewritten: each
230
+ * role holding contacts is named, with how many, in a needs-attention entry
231
+ * on the dashboard and a log line, and administrators get one notification
232
+ * (not a second while the first is still active). A contact cannot sign in,
233
+ * so such a membership gives nothing; an administrator decides what to do.
234
+ *
235
+ * @returns role name → how many of its members are contacts
236
+ */
237
+ reportContactMembersAtBoot(): Promise<Record<string, number>>;
238
+ /**
239
+ * One error notification for the users holding `admin-system`, unless one
240
+ * with this title is still active. Nobody to tell: the log line stands
241
+ * alone, since an empty target list would tell every user.
242
+ */
243
+ private notifyAdminsOnce;
202
244
  /** The account must exist; membership of a missing account is refused. */
203
245
  private requireAccount;
204
246
  /** #1204: a role assigned or removed is a user-edit; what the account may do changed. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jwilleke/ngdpbase-types",
3
- "version": "5.32.0",
3
+ "version": "5.33.0",
4
4
  "description": "TypeScript types for ngdpbase add-ons, and a test kit of core's own values. A dev dependency, versioned with ngdpbase.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Jim Willeke",