@spinajs/rbac-http-admin 2.0.470 → 2.0.471

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 (35) hide show
  1. package/lib/cjs/controllers/Users/Profile.d.ts +17 -1
  2. package/lib/cjs/controllers/Users/Profile.d.ts.map +1 -1
  3. package/lib/cjs/controllers/Users/Profile.js +16 -0
  4. package/lib/cjs/controllers/Users/Profile.js.map +1 -1
  5. package/lib/cjs/controllers/Users/Roles.d.ts +29 -2
  6. package/lib/cjs/controllers/Users/Roles.d.ts.map +1 -1
  7. package/lib/cjs/controllers/Users/Roles.js +29 -1
  8. package/lib/cjs/controllers/Users/Roles.js.map +1 -1
  9. package/lib/cjs/controllers/Users/Security.d.ts +64 -5
  10. package/lib/cjs/controllers/Users/Security.d.ts.map +1 -1
  11. package/lib/cjs/controllers/Users/Security.js +61 -2
  12. package/lib/cjs/controllers/Users/Security.js.map +1 -1
  13. package/lib/cjs/controllers/Users/Users.d.ts +78 -5
  14. package/lib/cjs/controllers/Users/Users.d.ts.map +1 -1
  15. package/lib/cjs/controllers/Users/Users.js +100 -11
  16. package/lib/cjs/controllers/Users/Users.js.map +1 -1
  17. package/lib/mjs/controllers/Users/Profile.d.ts +17 -1
  18. package/lib/mjs/controllers/Users/Profile.d.ts.map +1 -1
  19. package/lib/mjs/controllers/Users/Profile.js +16 -0
  20. package/lib/mjs/controllers/Users/Profile.js.map +1 -1
  21. package/lib/mjs/controllers/Users/Roles.d.ts +29 -2
  22. package/lib/mjs/controllers/Users/Roles.d.ts.map +1 -1
  23. package/lib/mjs/controllers/Users/Roles.js +29 -1
  24. package/lib/mjs/controllers/Users/Roles.js.map +1 -1
  25. package/lib/mjs/controllers/Users/Security.d.ts +64 -5
  26. package/lib/mjs/controllers/Users/Security.d.ts.map +1 -1
  27. package/lib/mjs/controllers/Users/Security.js +61 -2
  28. package/lib/mjs/controllers/Users/Security.js.map +1 -1
  29. package/lib/mjs/controllers/Users/Users.d.ts +78 -5
  30. package/lib/mjs/controllers/Users/Users.d.ts.map +1 -1
  31. package/lib/mjs/controllers/Users/Users.js +100 -11
  32. package/lib/mjs/controllers/Users/Users.js.map +1 -1
  33. package/lib/tsconfig.cjs.tsbuildinfo +1 -1
  34. package/lib/tsconfig.mjs.tsbuildinfo +1 -1
  35. package/package.json +11 -11
@@ -1,7 +1,23 @@
1
1
  import { BaseController, Ok } from '@spinajs/http';
2
2
  import { UserProfileProvider } from '@spinajs/rbac';
3
+ /**
4
+ * User profile management (admin).
5
+ * Provides administrative access to user profile data via the configured UserProfileProvider.
6
+ * @tags Admin Users
7
+ */
3
8
  export declare class Roles extends BaseController {
4
9
  protected ProfileService: UserProfileProvider;
5
- getUserProfile(login: string): Promise<Ok>;
10
+ /**
11
+ * Get user profile by login (admin)
12
+ * Retrieves extended profile data for the specified user via the configured UserProfileProvider.
13
+ * The shape of the returned profile depends on the active provider implementation.
14
+ * @security cookieAuth
15
+ * @param login User login name
16
+ * @returns {IUserProfile} User profile data as returned by the configured UserProfileProvider
17
+ * @response 401 Unauthorized — valid session required
18
+ * @response 403 Forbidden — readAny permission required on users resource
19
+ * @response 404 User not found
20
+ */
21
+ getUserProfile(login: string): Promise<Ok<import("@spinajs/rbac").UserProfile<unknown>>>;
6
22
  }
7
23
  //# sourceMappingURL=Profile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../../../src/controllers/Users/Profile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAiB,EAAE,EAAiB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAS,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAI3D,qBAGa,KAAM,SAAQ,cAAc;IAIrC,SAAS,CAAC,cAAc,EAAE,mBAAmB,CAAC;IAIjC,cAAc,CAAU,KAAK,EAAE,MAAM;CAGrD"}
1
+ {"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../../../src/controllers/Users/Profile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAiB,EAAE,EAAiB,MAAM,eAAe,CAAC;AACjF,OAAO,EAAS,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAI3D;;;;GAIG;AACH,qBAGa,KAAM,SAAQ,cAAc;IAIrC,SAAS,CAAC,cAAc,EAAE,mBAAmB,CAAC;IAE9C;;;;;;;;;;OAUG;IAGU,cAAc,CAAU,KAAK,EAAE,MAAM;CAGrD"}
@@ -17,7 +17,23 @@ const configuration_1 = require("@spinajs/configuration");
17
17
  const http_1 = require("@spinajs/http");
18
18
  const rbac_1 = require("@spinajs/rbac");
19
19
  const rbac_http_1 = require("@spinajs/rbac-http");
20
+ /**
21
+ * User profile management (admin).
22
+ * Provides administrative access to user profile data via the configured UserProfileProvider.
23
+ * @tags Admin Users
24
+ */
20
25
  let Roles = class Roles extends http_1.BaseController {
26
+ /**
27
+ * Get user profile by login (admin)
28
+ * Retrieves extended profile data for the specified user via the configured UserProfileProvider.
29
+ * The shape of the returned profile depends on the active provider implementation.
30
+ * @security cookieAuth
31
+ * @param login User login name
32
+ * @returns {IUserProfile} User profile data as returned by the configured UserProfileProvider
33
+ * @response 401 Unauthorized — valid session required
34
+ * @response 403 Forbidden — readAny permission required on users resource
35
+ * @response 404 User not found
36
+ */
21
37
  async getUserProfile(login) {
22
38
  return new http_1.Ok(this.ProfileService.retrieve(login));
23
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../../../src/controllers/Users/Profile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAA2D;AAC3D,wCAAiF;AACjF,wCAA2D;AAC3D,kDAA4E;AAMrE,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,qBAAc;IAQxB,AAAN,KAAK,CAAC,cAAc,CAAU,KAAa;QAC7C,OAAO,IAAI,SAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACxD,CAAC;CACJ,CAAA;AAXY,sBAAK;AAIJ;IADT,IAAA,iCAAiB,EAAC,cAAc,CAAC;8BACR,0BAAmB;6CAAC;AAIjC;IAFZ,IAAA,UAAG,EAAC,QAAQ,CAAC;IACb,IAAA,sBAAU,EAAC,CAAC,SAAS,CAAC,CAAC;IACK,WAAA,IAAA,YAAK,GAAE,CAAA;;;;2CAEnC;gBAVQ,KAAK;IAHjB,IAAA,eAAQ,EAAC,eAAe,CAAC;IACzB,IAAA,aAAM,EAAC,4BAAgB,CAAC;IACxB,IAAA,oBAAQ,EAAC,OAAO,CAAC;GACL,KAAK,CAWjB"}
1
+ {"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../../../src/controllers/Users/Profile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0DAA2D;AAC3D,wCAAiF;AACjF,wCAA2D;AAC3D,kDAA4E;AAG5E;;;;GAIG;AAII,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,qBAAc;IAMrC;;;;;;;;;;OAUG;IAGU,AAAN,KAAK,CAAC,cAAc,CAAU,KAAa;QAC7C,OAAO,IAAI,SAAE,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACxD,CAAC;CACJ,CAAA;AAtBY,sBAAK;AAIJ;IADT,IAAA,iCAAiB,EAAC,cAAc,CAAC;8BACR,0BAAmB;6CAAC;AAejC;IAFZ,IAAA,UAAG,EAAC,QAAQ,CAAC;IACb,IAAA,sBAAU,EAAC,CAAC,SAAS,CAAC,CAAC;IACK,WAAA,IAAA,YAAK,GAAE,CAAA;;;;2CAEnC;gBArBQ,KAAK;IAHjB,IAAA,eAAQ,EAAC,eAAe,CAAC;IACzB,IAAA,aAAM,EAAC,4BAAgB,CAAC;IACxB,IAAA,oBAAQ,EAAC,OAAO,CAAC;GACL,KAAK,CAsBjB"}
@@ -3,8 +3,35 @@ export declare class RoleDto {
3
3
  role: string;
4
4
  constructor(data: Partial<RoleDto>);
5
5
  }
6
+ /**
7
+ * User role management (admin).
8
+ * Grants and revokes RBAC roles for user accounts.
9
+ * @tags Admin Users
10
+ */
6
11
  export declare class Roles extends BaseController {
7
- addRole(login: string, roleDto: RoleDto): Promise<Ok>;
8
- revokeRole(login: string, roleDto: RoleDto): Promise<Ok>;
12
+ /**
13
+ * Grant role to user (admin)
14
+ * Assigns the specified RBAC role to the user identified by login name.
15
+ * @security cookieAuth
16
+ * @param login User login name
17
+ * @response 200 Role granted successfully
18
+ * @response 400 Invalid role name
19
+ * @response 401 Unauthorized — valid session required
20
+ * @response 403 Forbidden — updateAny permission required on users resource
21
+ * @response 404 User not found
22
+ */
23
+ addRole(login: string, roleDto: RoleDto): Promise<Ok<any>>;
24
+ /**
25
+ * Revoke role from user (admin)
26
+ * Removes the specified RBAC role from the user identified by login name.
27
+ * @security cookieAuth
28
+ * @param login User login name
29
+ * @response 200 Role revoked successfully
30
+ * @response 400 Invalid role name
31
+ * @response 401 Unauthorized — valid session required
32
+ * @response 403 Forbidden — updateAny permission required on users resource
33
+ * @response 404 User not found
34
+ */
35
+ revokeRole(login: string, roleDto: RoleDto): Promise<Ok<any>>;
9
36
  }
10
37
  //# sourceMappingURL=Roles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Roles.d.ts","sourceRoot":"","sources":["../../../../src/controllers/Users/Roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkB,EAAE,EAAwB,MAAM,eAAe,CAAC;AAMzF,qBAOa,OAAO;IACT,IAAI,EAAE,MAAM,CAAC;gBAER,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC;CAGrC;AAGD,qBAGa,KAAM,SAAQ,cAAc;IAGxB,OAAO,CAAU,KAAK,EAAE,MAAM,EAAU,OAAO,EAAE,OAAO;IAOxD,UAAU,CAAU,KAAK,EAAE,MAAM,EAAU,OAAO,EAAE,OAAO;CAI3E"}
1
+ {"version":3,"file":"Roles.d.ts","sourceRoot":"","sources":["../../../../src/controllers/Users/Roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkB,EAAE,EAAwB,MAAM,eAAe,CAAC;AAMzF,qBAQa,OAAO;IACT,IAAI,EAAE,MAAM,CAAC;gBAER,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC;CAGrC;AAGD;;;;GAIG;AACH,qBAGa,KAAM,SAAQ,cAAc;IACrC;;;;;;;;;;OAUG;IAGU,OAAO,CAAU,KAAK,EAAE,MAAM,EAAU,OAAO,EAAE,OAAO;IAKrE;;;;;;;;;;OAUG;IAGU,UAAU,CAAU,KAAK,EAAE,MAAM,EAAU,OAAO,EAAE,OAAO;CAI3E"}
@@ -28,16 +28,44 @@ exports.RoleDto = RoleDto = __decorate([
28
28
  type: 'object',
29
29
  $id: 'arrow.common.roleDTO',
30
30
  properties: {
31
- role: { type: 'string', minimum: 0, maximum: 32 },
31
+ role: { type: 'string', minLength: 1, maxLength: 32, description: 'RBAC role name to grant or revoke' },
32
32
  },
33
+ required: ['role'],
33
34
  }),
34
35
  __metadata("design:paramtypes", [Object])
35
36
  ], RoleDto);
37
+ /**
38
+ * User role management (admin).
39
+ * Grants and revokes RBAC roles for user accounts.
40
+ * @tags Admin Users
41
+ */
36
42
  let Roles = class Roles extends http_1.BaseController {
43
+ /**
44
+ * Grant role to user (admin)
45
+ * Assigns the specified RBAC role to the user identified by login name.
46
+ * @security cookieAuth
47
+ * @param login User login name
48
+ * @response 200 Role granted successfully
49
+ * @response 400 Invalid role name
50
+ * @response 401 Unauthorized — valid session required
51
+ * @response 403 Forbidden — updateAny permission required on users resource
52
+ * @response 404 User not found
53
+ */
37
54
  async addRole(login, roleDto) {
38
55
  await (0, rbac_1.grant)(login, roleDto.role);
39
56
  return new http_1.Ok();
40
57
  }
58
+ /**
59
+ * Revoke role from user (admin)
60
+ * Removes the specified RBAC role from the user identified by login name.
61
+ * @security cookieAuth
62
+ * @param login User login name
63
+ * @response 200 Role revoked successfully
64
+ * @response 400 Invalid role name
65
+ * @response 401 Unauthorized — valid session required
66
+ * @response 403 Forbidden — updateAny permission required on users resource
67
+ * @response 404 User not found
68
+ */
41
69
  async revokeRole(login, roleDto) {
42
70
  await (0, rbac_1.revoke)(login, roleDto.role);
43
71
  return new http_1.Ok();
@@ -1 +1 @@
1
- {"version":3,"file":"Roles.js","sourceRoot":"","sources":["../../../../src/controllers/Users/Roles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wCAAyF;AACzF,wCAAqD;AACrD,kDAA4E;AAC5E,oDAA6C;AAUtC,IAAM,OAAO,GAAb,MAAM,OAAO;IAGhB,YAAY,IAAsB;QAC9B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ,CAAA;AANY,0BAAO;kBAAP,OAAO;IAPnB,IAAA,mBAAM,EAAC;QACJ,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,sBAAsB;QAC3B,UAAU,EAAE;YACR,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;SACpD;KACJ,CAAC;;GACW,OAAO,CAMnB;AAMM,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,qBAAc;IAGxB,AAAN,KAAK,CAAC,OAAO,CAAU,KAAa,EAAU,OAAgB;QACjE,MAAM,IAAA,YAAK,EAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACjC,OAAO,IAAI,SAAE,EAAE,CAAA;IACnB,CAAC;IAIY,AAAN,KAAK,CAAC,UAAU,CAAU,KAAa,EAAU,OAAgB;QACpE,MAAM,IAAA,aAAM,EAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,OAAO,IAAI,SAAE,EAAE,CAAA;IACnB,CAAC;CACJ,CAAA;AAdY,sBAAK;AAGD;IAFZ,IAAA,YAAK,EAAC,YAAY,CAAC;IACnB,IAAA,sBAAU,EA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AM,IAAA,YAAK,EAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACjC,OAAO,IAAI,SAAE,EAAE,CAAA;IACnB,CAAC;IAED;;;;;;;;;;OAUG;IAGU,AAAN,KAAK,CAAC,UAAU,CAAU,KAAa,EAAU,OAAgB;QACpE,MAAM,IAAA,aAAM,EAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,OAAO,IAAI,SAAE,EAAE,CAAA;IACnB,CAAC;CACJ,CAAA;AApCY,sBAAK;AAcD;IAFZ,IAAA,YAAK,EAAC,YAAY,CAAC;IACnB,IAAA,sBAAU,EAAC,CAAC,WAAW,CAAC,CAAC;IACJ,WAAA,IAAA,YAAK,GAAE,CAAA;IAAiB,WAAA,IAAA,WAAI,GAAE,CAAA;;6CAAU,OAAO;;oCAGpE;AAeY;IAFZ,IAAA,YAAK,EAAC,eAAe,CAAC;IACtB,IAAA,sBAAU,EAAC,CAAC,WAAW,CAAC,CAAC;IACD,WAAA,IAAA,YAAK,GAAE,CAAA;IAAiB,WAAA,IAAA,WAAI,GAAE,CAAA;;6CAAU,OAAO;;uCAGvE;gBAnCQ,KAAK;IAHjB,IAAA,eAAQ,EAAC,YAAY,CAAC;IACtB,IAAA,aAAM,EAAC,4BAAgB,CAAC;IACxB,IAAA,oBAAQ,EAAC,OAAO,CAAC;GACL,KAAK,CAoCjB"}
@@ -5,13 +5,72 @@ declare class ChangePasswordDto {
5
5
  confirmPassword: string;
6
6
  constructor(data: any);
7
7
  }
8
+ /**
9
+ * User account security management (admin).
10
+ * Administrative controls for user account security: password changes, 2FA reset,
11
+ * account activation/deactivation, and forced session logout.
12
+ * @tags Admin Users
13
+ */
8
14
  export declare class Security extends BaseController {
9
15
  protected SessionProvider: SessionProvider;
10
- changeUserPassword(user: User, dto: ChangePasswordDto): Promise<Ok>;
11
- reset2faToken(user: User): Promise<Ok>;
12
- deactivateUser(user: User): Promise<Ok>;
13
- activateUser(user: User): Promise<Ok>;
14
- logoutUser(user: User): Promise<Ok>;
16
+ /**
17
+ * Change user password (admin)
18
+ * Sets a new password for the specified user. Both password and confirmPassword must match.
19
+ * Minimum length is 8 characters.
20
+ * @security cookieAuth
21
+ * @param user User UUID path parameter
22
+ * @response 200 Password changed successfully
23
+ * @response 400 Passwords do not match or fail validation
24
+ * @response 401 Unauthorized — valid session required
25
+ * @response 403 Forbidden — updateAny permission required on users resource
26
+ * @response 404 User not found
27
+ */
28
+ changeUserPassword(user: User, dto: ChangePasswordDto): Promise<Ok<any>>;
29
+ /**
30
+ * Reset user two-factor authentication (admin)
31
+ * Clears the TOTP secret and disables 2FA for the specified user.
32
+ * Use this to help a user regain access when they lose their authenticator device.
33
+ * @security cookieAuth
34
+ * @param user User UUID path parameter
35
+ * @response 200 2FA reset successfully
36
+ * @response 401 Unauthorized — valid session required
37
+ * @response 403 Forbidden — updateAny permission required on users resource
38
+ * @response 404 User not found
39
+ */
40
+ reset2faToken(user: User): Promise<Ok<any>>;
41
+ /**
42
+ * Deactivate user account (admin)
43
+ * Marks the user account as inactive, preventing login without deleting the record.
44
+ * @security cookieAuth
45
+ * @param user User UUID path parameter
46
+ * @response 200 Account deactivated successfully
47
+ * @response 401 Unauthorized — valid session required
48
+ * @response 403 Forbidden — deleteAny permission required on users resource
49
+ * @response 404 User not found
50
+ */
51
+ deactivateUser(user: User): Promise<Ok<any>>;
52
+ /**
53
+ * Activate user account (admin)
54
+ * Marks a previously deactivated user account as active, restoring login access.
55
+ * @security cookieAuth
56
+ * @param user User UUID path parameter
57
+ * @response 200 Account activated successfully
58
+ * @response 401 Unauthorized — valid session required
59
+ * @response 403 Forbidden — deleteAny permission required on users resource
60
+ * @response 404 User not found
61
+ */
62
+ activateUser(user: User): Promise<Ok<any>>;
63
+ /**
64
+ * Force logout user (admin)
65
+ * Invalidates all active sessions for the specified user, immediately ending any current logins.
66
+ * @security cookieAuth
67
+ * @param user User UUID path parameter
68
+ * @response 200 All sessions invalidated successfully
69
+ * @response 401 Unauthorized — valid session required
70
+ * @response 403 Forbidden — updateAny permission required on users resource
71
+ * @response 404 User not found
72
+ */
73
+ logoutUser(user: User): Promise<Ok<any>>;
15
74
  }
16
75
  export {};
17
76
  //# sourceMappingURL=Security.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Security.d.ts","sourceRoot":"","sources":["../../../../src/controllers/Users/Security.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,EAAE,EAAiB,MAAM,eAAe,CAAC;AAEvF,OAAO,EAA+C,eAAe,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAMnG,cAwBM,iBAAiB;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;gBAEnB,IAAI,EAAE,GAAG;CAGxB;AAGD,qBAGa,QAAS,SAAQ,cAAc;IAGxC,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAI9B,kBAAkB,CAAoC,IAAI,EAAE,IAAI,EAAU,GAAG,EAAE,iBAAiB;IAOhG,aAAa,CAAoC,IAAI,EAAE,IAAI;IAO3D,cAAc,CAAoC,IAAI,EAAE,IAAI;IAO5D,YAAY,CAAoC,IAAI,EAAE,IAAI;IAO1D,UAAU,CAAoC,IAAI,EAAE,IAAI;CAIxE"}
1
+ {"version":3,"file":"Security.d.ts","sourceRoot":"","sources":["../../../../src/controllers/Users/Security.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,EAAE,EAAiB,MAAM,eAAe,CAAC;AAEvF,OAAO,EAA+C,eAAe,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAMnG,cAwBM,iBAAiB;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;gBAEnB,IAAI,EAAE,GAAG;CAGxB;AAGD;;;;;GAKG;AACH,qBAGa,QAAS,SAAQ,cAAc;IAGxC,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAE3C;;;;;;;;;;;OAWG;IAGU,kBAAkB,CAAoC,IAAI,EAAE,IAAI,EAAU,GAAG,EAAE,iBAAiB;IAK7G;;;;;;;;;;OAUG;IAGU,aAAa,CAAoC,IAAI,EAAE,IAAI;IAKxE;;;;;;;;;OASG;IAGU,cAAc,CAAoC,IAAI,EAAE,IAAI;IAKzE;;;;;;;;;OASG;IAGU,YAAY,CAAoC,IAAI,EAAE,IAAI;IAKvE;;;;;;;;;OASG;IAGU,UAAU,CAAoC,IAAI,EAAE,IAAI;CAIxE"}
@@ -30,8 +30,8 @@ ChangePasswordDto = __decorate([
30
30
  type: 'object',
31
31
  $id: 'arrow.common.changePasswordDTO',
32
32
  properties: {
33
- password: { type: 'string', minLength: 8, maxLength: 128 },
34
- confirmPassword: { type: 'string', minLength: 8, maxLength: 128 }
33
+ password: { type: 'string', minLength: 8, maxLength: 128, description: 'New password (8–128 characters)' },
34
+ confirmPassword: { type: 'string', minLength: 8, maxLength: 128, description: 'Must match password' },
35
35
  },
36
36
  required: ['password', 'confirmPassword'],
37
37
  allOf: [
@@ -52,23 +52,82 @@ ChangePasswordDto = __decorate([
52
52
  }),
53
53
  __metadata("design:paramtypes", [Object])
54
54
  ], ChangePasswordDto);
55
+ /**
56
+ * User account security management (admin).
57
+ * Administrative controls for user account security: password changes, 2FA reset,
58
+ * account activation/deactivation, and forced session logout.
59
+ * @tags Admin Users
60
+ */
55
61
  let Security = class Security extends http_1.BaseController {
62
+ /**
63
+ * Change user password (admin)
64
+ * Sets a new password for the specified user. Both password and confirmPassword must match.
65
+ * Minimum length is 8 characters.
66
+ * @security cookieAuth
67
+ * @param user User UUID path parameter
68
+ * @response 200 Password changed successfully
69
+ * @response 400 Passwords do not match or fail validation
70
+ * @response 401 Unauthorized — valid session required
71
+ * @response 403 Forbidden — updateAny permission required on users resource
72
+ * @response 404 User not found
73
+ */
56
74
  async changeUserPassword(user, dto) {
57
75
  await (0, rbac_1.changePassword)(dto.password)(user);
58
76
  return new http_1.Ok();
59
77
  }
78
+ /**
79
+ * Reset user two-factor authentication (admin)
80
+ * Clears the TOTP secret and disables 2FA for the specified user.
81
+ * Use this to help a user regain access when they lose their authenticator device.
82
+ * @security cookieAuth
83
+ * @param user User UUID path parameter
84
+ * @response 200 2FA reset successfully
85
+ * @response 401 Unauthorized — valid session required
86
+ * @response 403 Forbidden — updateAny permission required on users resource
87
+ * @response 404 User not found
88
+ */
60
89
  async reset2faToken(user) {
61
90
  await (0, rbac_http_user_1.resetUser2Fa)(user);
62
91
  return new http_1.Ok();
63
92
  }
93
+ /**
94
+ * Deactivate user account (admin)
95
+ * Marks the user account as inactive, preventing login without deleting the record.
96
+ * @security cookieAuth
97
+ * @param user User UUID path parameter
98
+ * @response 200 Account deactivated successfully
99
+ * @response 401 Unauthorized — valid session required
100
+ * @response 403 Forbidden — deleteAny permission required on users resource
101
+ * @response 404 User not found
102
+ */
64
103
  async deactivateUser(user) {
65
104
  await (0, rbac_1.deactivate)(user);
66
105
  return new http_1.Ok();
67
106
  }
107
+ /**
108
+ * Activate user account (admin)
109
+ * Marks a previously deactivated user account as active, restoring login access.
110
+ * @security cookieAuth
111
+ * @param user User UUID path parameter
112
+ * @response 200 Account activated successfully
113
+ * @response 401 Unauthorized — valid session required
114
+ * @response 403 Forbidden — deleteAny permission required on users resource
115
+ * @response 404 User not found
116
+ */
68
117
  async activateUser(user) {
69
118
  await (0, rbac_1.activate)(user);
70
119
  return new http_1.Ok();
71
120
  }
121
+ /**
122
+ * Force logout user (admin)
123
+ * Invalidates all active sessions for the specified user, immediately ending any current logins.
124
+ * @security cookieAuth
125
+ * @param user User UUID path parameter
126
+ * @response 200 All sessions invalidated successfully
127
+ * @response 401 Unauthorized — valid session required
128
+ * @response 403 Forbidden — updateAny permission required on users resource
129
+ * @response 404 User not found
130
+ */
72
131
  async logoutUser(user) {
73
132
  await this.SessionProvider.logsOut(user);
74
133
  return new http_1.Ok();
@@ -1 +1 @@
1
- {"version":3,"file":"Security.js","sourceRoot":"","sources":["../../../../src/controllers/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,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAA;;qCAAO,WAAI;;0CAGpE;mBA3FQ,QAAQ;IAHpB,IAAA,eAAQ,EAAC,gBAAgB,CAAC;IAC1B,IAAA,aAAM,EAAC,4BAAgB,CAAC;IACxB,IAAA,oBAAQ,EAAC,OAAO,CAAC;GACL,QAAQ,CA4FpB"}
@@ -10,13 +10,86 @@ declare class UserDto {
10
10
  };
11
11
  constructor(data: Partial<UserDto>);
12
12
  }
13
+ /**
14
+ * User account management (admin).
15
+ * Full CRUD operations for user accounts. Supports pagination, sorting, filtering,
16
+ * and optional relation loading. All write operations require full authorization.
17
+ * @tags Admin Users
18
+ */
13
19
  export declare class Users extends BaseController {
14
20
  protected PasswordProvider: PasswordProvider;
15
- list(pagination?: PaginationDTO, order?: OrderDTO, include?: string[], filter?: IFilterRequest): Promise<Ok>;
16
- getSingleUser(user: User, include?: string[]): Promise<Ok>;
17
- getByLogin(user: User, include?: string[]): Promise<Ok>;
18
- addUser(data: UserDto): Promise<Ok>;
19
- updateUser(user: User, data: UserDto): Promise<Ok>;
21
+ /**
22
+ * List users (admin)
23
+ * Returns a paginated, sortable, filterable list of all users. Supports optional inclusion
24
+ * of related Metadata. The total user count (matching current filters) is returned in the
25
+ * X-Total-Count response header.
26
+ * Filterable fields: Uuid (eq), Email (eq, like), Login (eq, like), CreatedAt, LastLoginAt,
27
+ * DeletedAt (eq, gte, lte, lt, gt, isnull, notnull), IsActive (eq), Role (eq, neq),
28
+ * user:niceName metadata (eq, neq, like).
29
+ * @security cookieAuth
30
+ * @param pagination.page Page number (zero-based)
31
+ * @param pagination.limit Number of users per page (default: 10)
32
+ * @param order.column Column to sort by (default: CreatedAt)
33
+ * @param order.order Sort direction: ASC or DESC (default: DESC)
34
+ * @param include Relations to include — currently supports: Metadata
35
+ * @returns {IUserData[]} Paginated list of user accounts, each with optional Metadata relation
36
+ * @response 401 Unauthorized — valid session required
37
+ * @response 403 Forbidden — readAny permission required on users resource
38
+ */
39
+ list(pagination?: PaginationDTO, order?: OrderDTO, include?: string[], filter?: IFilterRequest): Promise<Ok<import("@spinajs/orm").ModelDataWithRelationData<User>[]>>;
40
+ /**
41
+ * Get user by UUID (admin)
42
+ * Retrieves a single user record by UUID. Supports optional inclusion of related Metadata.
43
+ * @security cookieAuth
44
+ * @param user User UUID path parameter
45
+ * @param include Relations to include — currently supports: Metadata
46
+ * @returns {IUserData} User account with optional Metadata relation
47
+ * @response 401 Unauthorized — valid session required
48
+ * @response 403 Forbidden — readAny permission required on users resource
49
+ * @response 404 User not found
50
+ */
51
+ getSingleUser(user: User, include?: string[]): Promise<Ok<import("@spinajs/orm").ModelDataWithRelationData<User>>>;
52
+ /**
53
+ * Get user by login (admin)
54
+ * Retrieves a single user record by login name. Supports optional inclusion of related Metadata.
55
+ * @security cookieAuth
56
+ * @param user User login name path parameter
57
+ * @param include Relations to include — currently supports: Metadata
58
+ * @returns {IUserData} User account with optional Metadata relation
59
+ * @response 401 Unauthorized — valid session required
60
+ * @response 403 Forbidden — readAny permission required on users resource
61
+ * @response 404 User not found
62
+ */
63
+ getByLogin(user: User, include?: string[]): Promise<Ok<import("@spinajs/orm").ModelDataWithRelationData<User>>>;
64
+ /**
65
+ * Create user (admin)
66
+ * Creates a new user account with a system-generated temporary password.
67
+ * The temporary password is not returned — it should be delivered to the user via email or other channel.
68
+ * @security cookieAuth
69
+ * @returns {IUserData} Created user account
70
+ * @response 400 Validation error — missing required fields or invalid format
71
+ * @response 401 Unauthorized — valid session required
72
+ * @response 403 Forbidden — createAny permission required on users resource
73
+ * @response 409 Login or email already in use
74
+ */
75
+ addUser(data: UserDto): Promise<Ok<{
76
+ User: User;
77
+ Password: string;
78
+ }>>;
79
+ /**
80
+ * Update user (admin)
81
+ * Partially updates a user account. All fields are optional — only provided fields are changed.
82
+ * Metadata is merged: existing keys are updated, new keys are added, unlisted keys are preserved.
83
+ * @security cookieAuth
84
+ * @param user User UUID path parameter
85
+ * @response 200 User updated successfully
86
+ * @response 400 Validation error — invalid field format
87
+ * @response 401 Unauthorized — valid session required
88
+ * @response 403 Forbidden — updateAny permission required on users resource
89
+ * @response 404 User not found
90
+ * @response 409 Login or email already in use by another account
91
+ */
92
+ updateUser(user: User, data: UserDto): Promise<Ok<any>>;
20
93
  }
21
94
  export {};
22
95
  //# sourceMappingURL=Users.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Users.d.ts","sourceRoot":"","sources":["../../../../src/controllers/Users/Users.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAuB,EAAE,EAA8B,MAAM,eAAe,CAAC;AAEpG,OAAO,EAAyD,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnI,OAAO,EAAU,gBAAgB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAI/D,cAoBM,OAAO;IACJ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;gBAE7B,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC;CAGnC;AAqED,qBAGa,KAAM,SAAQ,cAAc;IAGvC,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAA;IAI/B,IAAI,CACN,UAAU,CAAC,EAAE,aAAa,EAC1B,KAAK,CAAC,EAAE,QAAQ,EAQzB,OAAO,CAAC,EAAE,MAAM,EAAE,EAElB,MAAM,CAAC,EAAE,cAAc;IAsCZ,aAAa,CAAoC,IAAI,EAAE,IAAI,EAOxE,OAAO,CAAC,EAAE,MAAM,EAAE;IAOL,UAAU,CAAqC,IAAI,EAAE,IAAI,EAOtE,OAAO,CAAC,EAAE,MAAM,EAAE;IASL,OAAO,CACV,IAAI,EAAE,OAAO;IAWV,UAAU,CACc,IAAI,EAAE,IAAI,EACrC,IAAI,EAAE,OAAO;CAuBxB"}
1
+ {"version":3,"file":"Users.d.ts","sourceRoot":"","sources":["../../../../src/controllers/Users/Users.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAuB,EAAE,EAA8B,MAAM,eAAe,CAAC;AAEpG,OAAO,EAAyD,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnI,OAAO,EAAU,gBAAgB,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAI/D,cAoBM,OAAO;IACJ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;gBAE7B,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC;CAGnC;AAqED;;;;;GAKG;AACH,qBAGa,KAAM,SAAQ,cAAc;IAGvC,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAA;IAE5C;;;;;;;;;;;;;;;;;OAiBG;IAGU,IAAI,CACN,UAAU,CAAC,EAAE,aAAa,EAC1B,KAAK,CAAC,EAAE,QAAQ,EAQzB,OAAO,CAAC,EAAE,MAAM,EAAE,EAElB,MAAM,CAAC,EAAE,cAAc;IAqCzB;;;;;;;;;;OAUG;IAEU,aAAa,CAAoC,IAAI,EAAE,IAAI,EAOxE,OAAO,CAAC,EAAE,MAAM,EAAE;IAMlB;;;;;;;;;;OAUG;IAEU,UAAU,CAAqC,IAAI,EAAE,IAAI,EAOtE,OAAO,CAAC,EAAE,MAAM,EAAE;IAOlB;;;;;;;;;;OAUG;IAGU,OAAO,CACV,IAAI,EAAE,OAAO;;;;IASvB;;;;;;;;;;;;OAYG;IAGU,UAAU,CACc,IAAI,EAAE,IAAI,EACrC,IAAI,EAAE,OAAO;CAuBxB"}
@@ -30,18 +30,18 @@ UserDto = __decorate([
30
30
  type: 'object',
31
31
  $id: 'arrow.common.userDto',
32
32
  properties: {
33
- Login: { type: 'string', minLength: 3, maxLength: 32 },
34
- Email: { type: 'string', format: 'email' },
35
- Role: { type: 'string', minLength: 1, maxLength: 32 },
33
+ Login: { type: 'string', minLength: 3, maxLength: 32, description: 'Unique login name (3–32 characters)' },
34
+ Email: { type: 'string', format: 'email', description: 'Unique email address' },
35
+ Role: { type: 'string', minLength: 1, maxLength: 32, description: 'RBAC role to assign to the user' },
36
36
  Metadata: {
37
37
  type: 'object',
38
38
  $id: 'arrow.common.userMetadata',
39
39
  properties: {
40
- Key: { type: 'string', minLength: 1, maxLength: 64 },
41
- Value: { type: 'string', minLength: 0, maxLength: 256 },
40
+ Key: { type: 'string', minLength: 1, maxLength: 64, description: 'Metadata key' },
41
+ Value: { type: 'string', minLength: 0, maxLength: 256, description: 'Metadata value' },
42
42
  },
43
43
  additionalProperties: true,
44
- description: 'Additional metadata for the user, can be used to store custom data',
44
+ description: 'Optional key-value metadata to attach to the user account',
45
45
  },
46
46
  },
47
47
  required: ['Login', 'Email', 'Role'],
@@ -113,7 +113,31 @@ const USER_FILTER = [
113
113
  }
114
114
  }
115
115
  ];
116
+ /**
117
+ * User account management (admin).
118
+ * Full CRUD operations for user accounts. Supports pagination, sorting, filtering,
119
+ * and optional relation loading. All write operations require full authorization.
120
+ * @tags Admin Users
121
+ */
116
122
  let Users = class Users extends http_1.BaseController {
123
+ /**
124
+ * List users (admin)
125
+ * Returns a paginated, sortable, filterable list of all users. Supports optional inclusion
126
+ * of related Metadata. The total user count (matching current filters) is returned in the
127
+ * X-Total-Count response header.
128
+ * Filterable fields: Uuid (eq), Email (eq, like), Login (eq, like), CreatedAt, LastLoginAt,
129
+ * DeletedAt (eq, gte, lte, lt, gt, isnull, notnull), IsActive (eq), Role (eq, neq),
130
+ * user:niceName metadata (eq, neq, like).
131
+ * @security cookieAuth
132
+ * @param pagination.page Page number (zero-based)
133
+ * @param pagination.limit Number of users per page (default: 10)
134
+ * @param order.column Column to sort by (default: CreatedAt)
135
+ * @param order.order Sort direction: ASC or DESC (default: DESC)
136
+ * @param include Relations to include — currently supports: Metadata
137
+ * @returns {IUserData[]} Paginated list of user accounts, each with optional Metadata relation
138
+ * @response 401 Unauthorized — valid session required
139
+ * @response 403 Forbidden — readAny permission required on users resource
140
+ */
117
141
  async list(pagination, order, include, filter) {
118
142
  const result = await rbac_1.User.select()
119
143
  .leftJoin("Metadata", function () {
@@ -124,12 +148,12 @@ let Users = class Users extends http_1.BaseController {
124
148
  }, function () {
125
149
  this.select('Value', "user:niceName");
126
150
  })
127
- .populate(include)
151
+ .populate(include ?? [])
128
152
  .take(pagination?.limit ?? 10)
129
- .skip(pagination?.limit * pagination?.page)
153
+ .skip((pagination?.limit ?? 0) * (pagination?.page ?? 0))
130
154
  .order(order?.column ?? 'CreatedAt', order?.order ?? orm_1.SortOrder.DESC)
131
- .filter(filter?.filters, filter?.op, USER_FILTER);
132
- const count = await rbac_1.User.query().filter(filter?.filters, filter?.op, USER_FILTER).selectCount();
155
+ .filter(filter?.filters ?? [], filter?.op, USER_FILTER);
156
+ const count = await rbac_1.User.query().filter(filter?.filters ?? [], filter?.op, USER_FILTER).selectCount();
133
157
  return new http_1.Ok(result.map((x) => x.dehydrateWithRelations({
134
158
  dateTimeFormat: "iso"
135
159
  })), {
@@ -141,21 +165,67 @@ let Users = class Users extends http_1.BaseController {
141
165
  ],
142
166
  });
143
167
  }
168
+ /**
169
+ * Get user by UUID (admin)
170
+ * Retrieves a single user record by UUID. Supports optional inclusion of related Metadata.
171
+ * @security cookieAuth
172
+ * @param user User UUID path parameter
173
+ * @param include Relations to include — currently supports: Metadata
174
+ * @returns {IUserData} User account with optional Metadata relation
175
+ * @response 401 Unauthorized — valid session required
176
+ * @response 403 Forbidden — readAny permission required on users resource
177
+ * @response 404 User not found
178
+ */
144
179
  async getSingleUser(user, include) {
145
180
  // linter hack, to alow incldue param,it is used by FromModel qery arg
146
181
  include;
147
182
  return new http_1.Ok(user.dehydrateWithRelations({ dateTimeFormat: 'iso' }));
148
183
  }
184
+ /**
185
+ * Get user by login (admin)
186
+ * Retrieves a single user record by login name. Supports optional inclusion of related Metadata.
187
+ * @security cookieAuth
188
+ * @param user User login name path parameter
189
+ * @param include Relations to include — currently supports: Metadata
190
+ * @returns {IUserData} User account with optional Metadata relation
191
+ * @response 401 Unauthorized — valid session required
192
+ * @response 403 Forbidden — readAny permission required on users resource
193
+ * @response 404 User not found
194
+ */
149
195
  async getByLogin(user, include) {
150
196
  // linter hack, to alow incldue param,it is used by FromModel qery arg
151
197
  include;
152
198
  return new http_1.Ok(user.dehydrateWithRelations({ dateTimeFormat: 'iso' }));
153
199
  }
200
+ /**
201
+ * Create user (admin)
202
+ * Creates a new user account with a system-generated temporary password.
203
+ * The temporary password is not returned — it should be delivered to the user via email or other channel.
204
+ * @security cookieAuth
205
+ * @returns {IUserData} Created user account
206
+ * @response 400 Validation error — missing required fields or invalid format
207
+ * @response 401 Unauthorized — valid session required
208
+ * @response 403 Forbidden — createAny permission required on users resource
209
+ * @response 409 Login or email already in use
210
+ */
154
211
  async addUser(data) {
155
212
  const temporaryPassword = this.PasswordProvider.generate();
156
213
  const u = await (0, rbac_1.create)(data.Email, data.Login, temporaryPassword, [data.Role], undefined, data.Metadata);
157
214
  return new http_1.Ok(u);
158
215
  }
216
+ /**
217
+ * Update user (admin)
218
+ * Partially updates a user account. All fields are optional — only provided fields are changed.
219
+ * Metadata is merged: existing keys are updated, new keys are added, unlisted keys are preserved.
220
+ * @security cookieAuth
221
+ * @param user User UUID path parameter
222
+ * @response 200 User updated successfully
223
+ * @response 400 Validation error — invalid field format
224
+ * @response 401 Unauthorized — valid session required
225
+ * @response 403 Forbidden — updateAny permission required on users resource
226
+ * @response 404 User not found
227
+ * @response 409 Login or email already in use by another account
228
+ */
159
229
  async updateUser(user, data) {
160
230
  user.Login = data.Login ?? user.Login;
161
231
  user.Email = data.Email ?? user.Email;
@@ -175,7 +245,26 @@ let Users = class Users extends http_1.BaseController {
175
245
  exports.Users = Users;
176
246
  __decorate([
177
247
  (0, di_1.Autoinject)(),
178
- __metadata("design:type", rbac_1.PasswordProvider)
248
+ __metadata("design:type", rbac_1.PasswordProvider
249
+ /**
250
+ * List users (admin)
251
+ * Returns a paginated, sortable, filterable list of all users. Supports optional inclusion
252
+ * of related Metadata. The total user count (matching current filters) is returned in the
253
+ * X-Total-Count response header.
254
+ * Filterable fields: Uuid (eq), Email (eq, like), Login (eq, like), CreatedAt, LastLoginAt,
255
+ * DeletedAt (eq, gte, lte, lt, gt, isnull, notnull), IsActive (eq), Role (eq, neq),
256
+ * user:niceName metadata (eq, neq, like).
257
+ * @security cookieAuth
258
+ * @param pagination.page Page number (zero-based)
259
+ * @param pagination.limit Number of users per page (default: 10)
260
+ * @param order.column Column to sort by (default: CreatedAt)
261
+ * @param order.order Sort direction: ASC or DESC (default: DESC)
262
+ * @param include Relations to include — currently supports: Metadata
263
+ * @returns {IUserData[]} Paginated list of user accounts, each with optional Metadata relation
264
+ * @response 401 Unauthorized — valid session required
265
+ * @response 403 Forbidden — readAny permission required on users resource
266
+ */
267
+ )
179
268
  ], Users.prototype, "PasswordProvider", void 0);
180
269
  __decorate([
181
270
  (0, http_1.Get)("/"),