@nymphjs/tilmeld 1.0.0-beta.14 → 1.0.0-beta.140

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.
Files changed (105) hide show
  1. package/CHANGELOG.md +668 -0
  2. package/README.md +21 -5
  3. package/dist/AbleObject.d.ts +20 -2
  4. package/dist/AbleObject.js +25 -13
  5. package/dist/AbleObject.js.map +1 -1
  6. package/dist/Group.d.ts +190 -27
  7. package/dist/Group.js +827 -440
  8. package/dist/Group.js.map +1 -1
  9. package/dist/Group.testArtifacts.d.ts +3 -0
  10. package/dist/Group.testArtifacts.js +120 -0
  11. package/dist/Group.testArtifacts.js.map +1 -0
  12. package/dist/Tilmeld.d.ts +275 -14
  13. package/dist/Tilmeld.js +789 -310
  14. package/dist/Tilmeld.js.map +1 -1
  15. package/dist/Tilmeld.types.d.ts +9 -9
  16. package/dist/Tilmeld.types.js +1 -2
  17. package/dist/User.d.ts +410 -41
  18. package/dist/User.js +2042 -1057
  19. package/dist/User.js.map +1 -1
  20. package/dist/User.testArtifacts.d.ts +3 -0
  21. package/dist/User.testArtifacts.js +175 -0
  22. package/dist/User.testArtifacts.js.map +1 -0
  23. package/dist/conf/defaults.d.ts +1 -1
  24. package/dist/conf/defaults.js +215 -141
  25. package/dist/conf/defaults.js.map +1 -1
  26. package/dist/conf/index.d.ts +361 -2
  27. package/dist/conf/index.js +2 -8
  28. package/dist/conf/index.js.map +1 -1
  29. package/dist/decorators/index.d.ts +2 -0
  30. package/dist/decorators/index.js +3 -0
  31. package/dist/decorators/index.js.map +1 -0
  32. package/dist/decorators/requireAbility.d.ts +10 -0
  33. package/dist/decorators/requireAbility.js +21 -0
  34. package/dist/decorators/requireAbility.js.map +1 -0
  35. package/dist/decorators/requireAuthentication.d.ts +8 -0
  36. package/dist/decorators/requireAuthentication.js +16 -0
  37. package/dist/decorators/requireAuthentication.js.map +1 -0
  38. package/dist/enforceTilmeld.d.ts +3 -0
  39. package/dist/enforceTilmeld.js +18 -0
  40. package/dist/enforceTilmeld.js.map +1 -0
  41. package/dist/errors/AccessControlError.d.ts +2 -1
  42. package/dist/errors/AccessControlError.js +3 -6
  43. package/dist/errors/AccessControlError.js.map +1 -1
  44. package/dist/errors/BadDataError.d.ts +2 -1
  45. package/dist/errors/BadDataError.js +3 -6
  46. package/dist/errors/BadDataError.js.map +1 -1
  47. package/dist/errors/BadEmailError.d.ts +2 -1
  48. package/dist/errors/BadEmailError.js +3 -6
  49. package/dist/errors/BadEmailError.js.map +1 -1
  50. package/dist/errors/BadUsernameError.d.ts +2 -1
  51. package/dist/errors/BadUsernameError.js +3 -6
  52. package/dist/errors/BadUsernameError.js.map +1 -1
  53. package/dist/errors/CouldNotChangeDefaultPrimaryGroupError.js +1 -5
  54. package/dist/errors/CouldNotChangeDefaultPrimaryGroupError.js.map +1 -1
  55. package/dist/errors/EmailChangeRateLimitExceededError.js +1 -5
  56. package/dist/errors/EmailChangeRateLimitExceededError.js.map +1 -1
  57. package/dist/errors/index.d.ts +6 -6
  58. package/dist/errors/index.js +6 -22
  59. package/dist/errors/index.js.map +1 -1
  60. package/dist/index.d.ts +10 -14
  61. package/dist/index.js +11 -35
  62. package/dist/index.js.map +1 -1
  63. package/dist/testArtifacts.d.ts +26 -0
  64. package/dist/testArtifacts.js +1346 -0
  65. package/dist/testArtifacts.js.map +1 -0
  66. package/dist/tilmeldJoiProps.d.ts +4 -5
  67. package/dist/tilmeldJoiProps.js +13 -18
  68. package/dist/tilmeldJoiProps.js.map +1 -1
  69. package/jest.config.js +31 -5
  70. package/package.json +49 -36
  71. package/src/AbleObject.ts +17 -11
  72. package/src/Group.testArtifacts.ts +159 -0
  73. package/src/Group.ts +712 -299
  74. package/src/Tilmeld.ts +666 -344
  75. package/src/Tilmeld.types.ts +9 -9
  76. package/src/User.testArtifacts.ts +226 -0
  77. package/src/User.ts +1984 -879
  78. package/src/conf/defaults.ts +205 -109
  79. package/src/conf/index.ts +381 -2
  80. package/src/decorators/index.ts +2 -0
  81. package/src/decorators/requireAbility.ts +26 -0
  82. package/src/decorators/requireAuthentication.ts +19 -0
  83. package/src/enforceTilmeld.ts +20 -0
  84. package/src/errors/AccessControlError.ts +4 -2
  85. package/src/errors/BadDataError.ts +4 -2
  86. package/src/errors/BadEmailError.ts +4 -2
  87. package/src/errors/BadUsernameError.ts +4 -2
  88. package/src/errors/index.ts +6 -6
  89. package/src/index.ts +11 -14
  90. package/src/testArtifacts.ts +2148 -0
  91. package/src/tilmeldJoiProps.ts +9 -24
  92. package/tsconfig.json +6 -3
  93. package/typedoc.json +4 -0
  94. package/dist/Group.test.d.ts +0 -1
  95. package/dist/Group.test.js +0 -48
  96. package/dist/Group.test.js.map +0 -1
  97. package/dist/User.test.d.ts +0 -1
  98. package/dist/User.test.js +0 -51
  99. package/dist/User.test.js.map +0 -1
  100. package/dist/conf/d.d.ts +0 -55
  101. package/dist/conf/d.js +0 -3
  102. package/dist/conf/d.js.map +0 -1
  103. package/src/Group.test.ts +0 -58
  104. package/src/User.test.ts +0 -61
  105. package/src/conf/d.ts +0 -303
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Tilmeld - User/Group System for Nymph
2
2
 
3
- Powerful object data storage and querying.
3
+ Application Data and Access Framework for Node.js and the browser.
4
4
 
5
- Tilmeld (the d is silent) is a user and group management system for Nymph. It provides strict access controls to protect entities from unauthorized access/modification. It allows for granting and revoking ad hoc abilities to users and groups, then checking for those abilities. It provides authentication services and features protection against XSRF attacks.
5
+ https://nymph.io/
6
+
7
+ Tilmeld (the d is silent) is a user and group management, access control, and authentication system for Nymph. It allows creation and management of users and groups, including the ability to manage multiple domains. It provides strict access controls to protect entities from unauthorized access/modification. It allows for granting and revoking ad hoc abilities to users and groups, then checking for those abilities. It provides authentication services and features protection against XSRF attacks.
6
8
 
7
9
  ## Installation
8
10
 
@@ -38,7 +40,7 @@ const nymph = new Nymph(
38
40
  new SQLite3Driver({
39
41
  filename: ':memory:',
40
42
  }),
41
- tilmeld
43
+ tilmeld,
42
44
  );
43
45
 
44
46
  // These are the classes specific to this instance of Tilmeld.
@@ -47,11 +49,25 @@ const { User, Group } = tilmeld;
47
49
 
48
50
  ## Options
49
51
 
50
- See the [config declaration file](src/conf/d.ts).
52
+ See the [config declaration file](src/conf/index.ts).
53
+
54
+ ## Abilities
55
+
56
+ There are a few abilities that Tilmeld uses internally:
57
+
58
+ - `system/admin` - A user with this ability has **all** abilities.
59
+ - `tilmeld/admin` - Allow the user to manage and edit other user's account and group information and grant/revoke abilities.
60
+ - `tilmeld/switch` - Allow the user to switch to other users (log in as them without their password).
61
+ - `tilmeld/domain/[domain]/admin` - Allow a user to create and edit users in a domain.
62
+ - `uid/get/[name]` - Allow the user to read the named UID.
63
+ - `uid/new/[name]` - Allow the user to read, create, and increment the named UID.
64
+ - `uid/set/[name]` - Allow the user to read, create, increment, set, and delete the named UID.
65
+
66
+ The admin and switch abilities cannot be inherited from groups.
51
67
 
52
68
  # License
53
69
 
54
- Copyright 2021 SciActive Inc
70
+ Copyright 2021-2026 SciActive Inc
55
71
 
56
72
  Licensed under the Apache License, Version 2.0 (the "License");
57
73
  you may not use this file except in compliance with the License.
@@ -1,7 +1,25 @@
1
1
  import { Entity } from '@nymphjs/nymph';
2
- export default abstract class AbleObject<T extends {
2
+ export interface AbleObjectData {
3
3
  abilities?: string[];
4
- }> extends Entity<T> {
4
+ }
5
+ export interface AbleObject<T extends {}> extends AbleObjectData {
6
+ }
7
+ /**
8
+ * AbleObject abstract class.
9
+ *
10
+ * Used in entities which support abilities, such as users and groups.
11
+ */
12
+ export declare abstract class AbleObject<T extends {}> extends Entity<T & AbleObjectData> {
13
+ /**
14
+ * Grant an ability.
15
+ *
16
+ * @param ability The ability.
17
+ */
5
18
  $grant(ability: string): void;
19
+ /**
20
+ * Revoke an ability.
21
+ *
22
+ * @param ability The ability.
23
+ */
6
24
  $revoke(ability: string): void;
7
25
  }
@@ -1,27 +1,39 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const nymph_1 = require("@nymphjs/nymph");
4
- class AbleObject extends nymph_1.Entity {
1
+ import { Entity } from '@nymphjs/nymph';
2
+ /**
3
+ * AbleObject abstract class.
4
+ *
5
+ * Used in entities which support abilities, such as users and groups.
6
+ */
7
+ export class AbleObject extends Entity {
8
+ /**
9
+ * Grant an ability.
10
+ *
11
+ * @param ability The ability.
12
+ */
5
13
  $grant(ability) {
6
- if (!Array.isArray(this.$data.abilities)) {
7
- this.$data.abilities = [];
14
+ if (!Array.isArray(this.abilities)) {
15
+ this.abilities = [];
8
16
  }
9
- if (this.$data.abilities.indexOf(ability) === -1) {
10
- this.$data.abilities.push(ability);
17
+ if (!this.abilities.includes(ability)) {
18
+ this.abilities.push(ability);
11
19
  }
12
20
  }
21
+ /**
22
+ * Revoke an ability.
23
+ *
24
+ * @param ability The ability.
25
+ */
13
26
  $revoke(ability) {
14
- if (!Array.isArray(this.$data.abilities)) {
15
- this.$data.abilities = [];
27
+ if (!Array.isArray(this.abilities)) {
28
+ this.abilities = [];
16
29
  }
17
30
  let idx;
18
31
  do {
19
- idx = this.$data.abilities.indexOf(ability);
32
+ idx = this.abilities.indexOf(ability);
20
33
  if (idx !== -1) {
21
- this.$data.abilities.splice(idx, 1);
34
+ this.abilities.splice(idx, 1);
22
35
  }
23
36
  } while (idx !== -1);
24
37
  }
25
38
  }
26
- exports.default = AbleObject;
27
39
  //# sourceMappingURL=AbleObject.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AbleObject.js","sourceRoot":"","sources":["../src/AbleObject.ts"],"names":[],"mappings":";;AAAA,0CAAwC;AAOxC,MAA8B,UAE5B,SAAQ,cAAS;IAMV,MAAM,CAAC,OAAe;QAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;YACxC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;SAC3B;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE;YAChD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACpC;IACH,CAAC;IAOM,OAAO,CAAC,OAAe;QAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;YACxC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;SAC3B;QACD,IAAI,GAAW,CAAC;QAChB,GAAG;YACD,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;gBACd,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;aACrC;SACF,QAAQ,GAAG,KAAK,CAAC,CAAC,EAAE;IACvB,CAAC;CACF;AAlCD,6BAkCC"}
1
+ {"version":3,"file":"AbleObject.js","sourceRoot":"","sources":["../src/AbleObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAQxC;;;;GAIG;AACH,MAAM,OAAgB,UAAyB,SAAQ,MAEtD;IACC;;;;OAIG;IACI,MAAM,CAAC,OAAe;QAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,OAAe;QAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,GAAW,CAAC;QAChB,GAAG,CAAC;YACF,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACtC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAChC,CAAC;QACH,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,EAAE;IACvB,CAAC;CACF"}
package/dist/Group.d.ts CHANGED
@@ -1,25 +1,109 @@
1
- import { EntityData, EntityJson, EntityPatch, Options, Selector, SerializedEntityData } from '@nymphjs/nymph';
2
- import type Tilmeld from './Tilmeld';
3
- import AbleObject from './AbleObject';
4
- import User, { UserData } from './User';
5
- export type GroupData = {
1
+ import { type EntityJson, type EntityPatch, type Options, type Selector, type SerializedEntityData } from '@nymphjs/nymph';
2
+ import { AbleObject } from './AbleObject.js';
3
+ import { User as UserClass } from './User.js';
4
+ export type GroupEventType = 'checkGroupname' | 'beforeSave' | 'afterSave' | 'beforeDelete' | 'afterDelete';
5
+ /**
6
+ * This is run when the user has entered an otherwise valid groupname into the
7
+ * signup form. It should return a result, which when false will stop the
8
+ * process and return the included message, disallowing the groupname.
9
+ */
10
+ export type TilmeldCheckGroupnameCallback = (group: Group, data: {
11
+ groupname: string;
12
+ }) => Promise<{
13
+ result: boolean;
14
+ message?: string;
15
+ }>;
16
+ /**
17
+ * This is run just before the group is saved, so all checks have passed.
18
+ *
19
+ * The transaction is available in `group.$nymph`.
20
+ */
21
+ export type TilmeldBeforeGroupSaveCallback = (group: Group) => Promise<void>;
22
+ /**
23
+ * This is run before the transaction is committed, and you can perform
24
+ * additional functions on the transaction, which is available in
25
+ * `group.$nymph`.
26
+ */
27
+ export type TilmeldAfterGroupSaveCallback = (group: Group) => Promise<void>;
28
+ /**
29
+ * The transaction is available in `group.$nymph`.
30
+ */
31
+ export type TilmeldBeforeGroupDeleteCallback = (group: Group) => Promise<void>;
32
+ /**
33
+ * This is run before the transaction is committed, and you can perform
34
+ * additional functions on the transaction, which is available in
35
+ * `group.$nymph`.
36
+ */
37
+ export type TilmeldAfterGroupDeleteCallback = (group: Group) => Promise<void>;
38
+ export interface GroupData {
39
+ /**
40
+ * The abilities granted to the group.
41
+ */
6
42
  abilities?: string[];
43
+ /**
44
+ * The group's groupname.
45
+ */
7
46
  groupname?: string;
47
+ /**
48
+ * The group's name.
49
+ */
8
50
  name?: string;
51
+ /**
52
+ * The group's email address.
53
+ */
9
54
  email?: string;
55
+ /**
56
+ * The group's avatar URL. (Use getAvatar() to support Gravatar.)
57
+ */
10
58
  avatar?: string;
59
+ /**
60
+ * The group's telephone number.
61
+ */
11
62
  phone?: string;
12
- parent?: Group & GroupData;
13
- user?: (User & UserData) | null;
63
+ /**
64
+ * The group's parent.
65
+ */
66
+ parent?: Group;
67
+ /**
68
+ * If generatePrimary is on, this will be the user who generated this group.
69
+ */
70
+ user?: UserClass | null;
71
+ /**
72
+ * Whether the group can be used.
73
+ */
14
74
  enabled?: boolean;
75
+ /**
76
+ * Whether this group is the default primary group for new users.
77
+ */
15
78
  defaultPrimary?: boolean;
79
+ /**
80
+ * Whether this group is a default secondary group for new users.
81
+ */
16
82
  defaultSecondary?: boolean;
83
+ /**
84
+ * Whether this group is a default secondary group for unverified users.
85
+ */
17
86
  unverifiedSecondary?: boolean;
18
- };
19
- export default class Group extends AbleObject<GroupData> {
20
- static tilmeld: Tilmeld;
87
+ }
88
+ export interface Group extends GroupData {
89
+ }
90
+ /**
91
+ * A user group data model.
92
+ *
93
+ * Written by Hunter Perrin for SciActive.
94
+ *
95
+ * @author Hunter Perrin <hperrin@port87.com>
96
+ * @copyright SciActive Inc
97
+ * @see http://nymph.io/
98
+ */
99
+ export declare class Group extends AbleObject<GroupData> {
21
100
  static ETYPE: string;
22
101
  static class: string;
102
+ private static checkGroupnameCallbacks;
103
+ private static beforeSaveCallbacks;
104
+ private static afterSaveCallbacks;
105
+ private static beforeDeleteCallbacks;
106
+ private static afterDeleteCallbacks;
23
107
  private static DEFAULT_PRIVATE_DATA;
24
108
  private static DEFAULT_ALLOWLIST_DATA;
25
109
  protected $tags: never[];
@@ -29,35 +113,114 @@ export default class Group extends AbleObject<GroupData> {
29
113
  static searchRestrictedData: string[];
30
114
  protected $allowlistData?: string[] | undefined;
31
115
  protected $allowlistTags?: string[];
116
+ /**
117
+ * This should only be used by the backend.
118
+ */
32
119
  private $skipAcWhenSaving;
33
- static factory(guid?: string): Promise<Group & GroupData>;
34
- static factoryGroupname(groupname?: string): Promise<Group & GroupData>;
35
- static factorySync(guid?: string): Group & GroupData;
36
- constructor(guid?: string);
37
- static getPrimaryGroups(options?: Options, selectors?: Selector[]): Promise<(Group & GroupData)[]>;
38
- static getSecondaryGroups(options?: Options, selectors?: Selector[]): Promise<(Group & GroupData)[]>;
120
+ /**
121
+ * This should only be used by the backend.
122
+ */
123
+ private $skipAcWhenDeleting;
124
+ /**
125
+ * Used to save the current groupname for domain admin permissions.
126
+ */
127
+ $originalGroupname?: string;
128
+ static getFTSText(name: string, value: any): string | null;
129
+ static factoryGroupname(groupname?: string): Promise<Group>;
130
+ /**
131
+ * Get all the groups that can be assigned as primary groups.
132
+ *
133
+ * @param options The options for an optional search query.
134
+ * @param selectors The selectors for an optional search query.
135
+ * @returns An array of the assignable primary groups.
136
+ */
137
+ static getPrimaryGroups(options?: Options, selectors?: Selector[]): Promise<Group[]>;
138
+ /**
139
+ * Get all the groups that can be assigned as secondary groups.
140
+ *
141
+ * @param options The options for an optional search query.
142
+ * @param selectors The selectors for an optional search query.
143
+ * @returns An array of the assignable secondary groups.
144
+ */
145
+ static getSecondaryGroups(options?: Options, selectors?: Selector[]): Promise<Group[]>;
39
146
  private static getAssignableGroups;
147
+ constructor();
148
+ $getUniques(): Promise<string[]>;
40
149
  $getAvatar(): string;
41
150
  $jsonAcceptData(input: EntityJson, allowConflict?: boolean): void;
42
151
  $jsonAcceptPatch(patch: EntityPatch, allowConflict?: boolean): void;
43
- $putData(data: EntityData, sdata?: SerializedEntityData): void;
44
- $updateDataProtection(givenUser?: User & UserData): void;
45
- $isDescendant(givenGroup: (Group & GroupData) | string): boolean;
46
- $getChildren(): Promise<(Group & GroupData)[]>;
47
- $getDescendants(andSelf?: boolean): Promise<(Group & GroupData)[]>;
48
- $getDescendantsSync(andSelf?: boolean): (Group & GroupData)[];
49
- $getLevel(): number;
50
- $getUsers(descendants?: boolean, limit?: number, offset?: number): Promise<(User & UserData)[]>;
152
+ private $checkIncomingAbilities;
153
+ $putData(data: GroupData, sdata?: SerializedEntityData, source?: 'server'): void;
154
+ /**
155
+ * Update the data protection arrays for the current user.
156
+ */
157
+ $updateDataProtection(): void;
158
+ /**
159
+ * Check whether the group is a descendant of the given group.
160
+ *
161
+ * @param group The group, or the group's GUID.
162
+ * @returns True or false.
163
+ */
164
+ $isDescendant(givenGroup: Group | string): Promise<boolean>;
165
+ /**
166
+ * Gets an array of the group's child groups.
167
+ *
168
+ * @returns An array of groups.
169
+ */
170
+ $getChildren(): Promise<Group[]>;
171
+ /**
172
+ * Gets an array of the group's descendant groups.
173
+ *
174
+ * @param andSelf Include this group in the returned array.
175
+ * @param andDisabled Include disabled groups.
176
+ * @returns An array of groups.
177
+ */
178
+ $getDescendants(andSelf?: boolean, andDisabled?: boolean): Promise<Group[]>;
179
+ /**
180
+ * Get the number of parents the group has.
181
+ *
182
+ * If the group is a top level group, this will return 0. If it is a child of
183
+ * a top level group, this will return 1. If it is a grandchild of a top level
184
+ * group, this will return 2, and so on.
185
+ *
186
+ * Levels will max out at 1024 to avoid recursive loops.
187
+ *
188
+ * @returns The level of the group.
189
+ */
190
+ $getLevel(): Promise<number>;
191
+ /**
192
+ * Gets an array of enabled users in the group.
193
+ *
194
+ * @param descendants Include users in all descendant groups too.
195
+ * @param limit The limit for the query.
196
+ * @param offset The offset for the query.
197
+ * @returns An array of users.
198
+ */
199
+ $getUsers(descendants?: boolean, limit?: number, offset?: number): Promise<UserClass[]>;
200
+ /**
201
+ * Check that a groupname is valid.
202
+ *
203
+ * @returns An object with a boolean 'result' entry and a 'message' entry.
204
+ */
51
205
  $checkGroupname(): Promise<{
52
206
  result: boolean;
53
207
  message: string;
54
208
  }>;
209
+ /**
210
+ * Check that an email is unique.
211
+ *
212
+ * @returns An object with a boolean 'result' entry and a 'message' entry.
213
+ */
55
214
  $checkEmail(): Promise<{
56
215
  result: boolean;
57
216
  message: string;
58
217
  }>;
59
- $save(): Promise<boolean>;
60
- $saveSkipAC(): Promise<boolean>;
218
+ $save(): Promise<void>;
219
+ $saveSkipAC(): Promise<void>;
61
220
  $tilmeldSaveSkipAC(): boolean;
62
- $delete(): Promise<boolean>;
221
+ $delete(): Promise<void>;
222
+ $deleteSkipAC(): Promise<void>;
223
+ $tilmeldDeleteSkipAC(): boolean;
224
+ static on<T extends GroupEventType>(event: T, callback: T extends 'checkGroupname' ? TilmeldCheckGroupnameCallback : T extends 'beforeSave' ? TilmeldBeforeGroupSaveCallback : T extends 'afterSave' ? TilmeldAfterGroupSaveCallback : T extends 'beforeDelete' ? TilmeldBeforeGroupDeleteCallback : T extends 'afterDelete' ? TilmeldAfterGroupDeleteCallback : never): () => boolean;
225
+ static off<T extends GroupEventType>(event: T, callback: T extends 'checkGroupname' ? TilmeldCheckGroupnameCallback : T extends 'beforeSave' ? TilmeldBeforeGroupSaveCallback : T extends 'afterSave' ? TilmeldAfterGroupSaveCallback : T extends 'beforeDelete' ? TilmeldBeforeGroupDeleteCallback : T extends 'afterDelete' ? TilmeldAfterGroupDeleteCallback : never): boolean;
63
226
  }