@abpjs/identity 2.7.0 → 3.0.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.
package/dist/index.d.mts CHANGED
@@ -1,38 +1,43 @@
1
- import { ABP, RestService } from '@abpjs/core';
1
+ import { RoutesService, ABP, RestService } from '@abpjs/core';
2
2
  import React from 'react';
3
3
 
4
4
  /**
5
- * Component keys for the Identity module.
6
- * These keys are used for component replacement/customization.
7
- * @since 2.7.0
5
+ * Policy names for Identity module permissions.
6
+ * Used to check authorization for identity management operations.
7
+ *
8
+ * @since 3.0.0
8
9
  */
9
- declare const eIdentityComponents: {
10
+ declare const eIdentityPolicyNames: {
10
11
  /**
11
- * Key for the Roles component.
12
- * Use this to replace the default RolesComponent with a custom implementation.
12
+ * Combined policy for identity management (Roles OR Users).
13
+ * Use this for the main Identity Management menu item.
13
14
  */
14
- readonly Roles: "Identity.RolesComponent";
15
+ readonly IdentityManagement: "AbpIdentity.Roles || AbpIdentity.Users";
15
16
  /**
16
- * Key for the Users component.
17
- * Use this to replace the default UsersComponent with a custom implementation.
17
+ * Policy for role management.
18
18
  */
19
- readonly Users: "Identity.UsersComponent";
19
+ readonly Roles: "AbpIdentity.Roles";
20
+ /**
21
+ * Policy for user management.
22
+ */
23
+ readonly Users: "AbpIdentity.Users";
20
24
  };
21
25
  /**
22
- * Type for identity component key values
26
+ * Type for identity policy name values
23
27
  */
24
- type IdentityComponentKey = (typeof eIdentityComponents)[keyof typeof eIdentityComponents];
28
+ type IdentityPolicyNameKey = (typeof eIdentityPolicyNames)[keyof typeof eIdentityPolicyNames];
25
29
 
26
30
  /**
27
31
  * Route names for the Identity module.
28
32
  * These are used for navigation menu items and breadcrumbs.
29
- * @since 2.7.0
33
+ *
34
+ * @since 2.7.0 - Original location in lib/enums
35
+ * @since 3.0.0 - Moved to config/enums, removed Administration key
36
+ *
37
+ * Note: In v3.0.0, the Administration key was removed from this enum.
38
+ * The Administration menu item is now managed by @abpjs/core or individual modules.
30
39
  */
31
40
  declare const eIdentityRouteNames: {
32
- /**
33
- * Administration menu item name.
34
- */
35
- readonly Administration: "AbpUiNavigation::Menu:Administration";
36
41
  /**
37
42
  * Identity Management menu item name.
38
43
  */
@@ -51,6 +56,77 @@ declare const eIdentityRouteNames: {
51
56
  */
52
57
  type IdentityRouteNameKey = (typeof eIdentityRouteNames)[keyof typeof eIdentityRouteNames];
53
58
 
59
+ /**
60
+ * Route provider for Identity module.
61
+ * Provides route configuration for the identity management routes.
62
+ *
63
+ * @since 3.0.0
64
+ */
65
+
66
+ /**
67
+ * Configures the identity module routes.
68
+ * Returns a function that adds the routes to the RoutesService.
69
+ *
70
+ * @param routes - The RoutesService instance to add routes to
71
+ * @returns A function that adds the identity routes when called
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const routes = getRoutesService();
76
+ * const addRoutes = configureRoutes(routes);
77
+ * addRoutes();
78
+ * ```
79
+ */
80
+ declare function configureRoutes(routes: RoutesService): () => void;
81
+ /**
82
+ * Identity route providers configuration object.
83
+ * Use this to configure identity routes in your application.
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * // In your app initialization:
88
+ * const routes = getRoutesService();
89
+ * const addRoutes = IDENTITY_ROUTE_PROVIDERS.configureRoutes(routes);
90
+ * addRoutes();
91
+ * ```
92
+ */
93
+ declare const IDENTITY_ROUTE_PROVIDERS: {
94
+ configureRoutes: typeof configureRoutes;
95
+ };
96
+ /**
97
+ * Initializes the identity module routes using the global RoutesService.
98
+ * Call this function during application startup to register identity routes.
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * // In your app initialization:
103
+ * initializeIdentityRoutes();
104
+ * ```
105
+ */
106
+ declare function initializeIdentityRoutes(): void;
107
+
108
+ /**
109
+ * Component keys for the Identity module.
110
+ * These keys are used for component replacement/customization.
111
+ * @since 2.7.0
112
+ */
113
+ declare const eIdentityComponents: {
114
+ /**
115
+ * Key for the Roles component.
116
+ * Use this to replace the default RolesComponent with a custom implementation.
117
+ */
118
+ readonly Roles: "Identity.RolesComponent";
119
+ /**
120
+ * Key for the Users component.
121
+ * Use this to replace the default UsersComponent with a custom implementation.
122
+ */
123
+ readonly Users: "Identity.UsersComponent";
124
+ };
125
+ /**
126
+ * Type for identity component key values
127
+ */
128
+ type IdentityComponentKey = (typeof eIdentityComponents)[keyof typeof eIdentityComponents];
129
+
54
130
  /**
55
131
  * Identity namespace containing all types related to identity management.
56
132
  * Translated from @abp/ng.identity Identity namespace.
@@ -170,7 +246,9 @@ declare namespace Identity {
170
246
  * Service for managing identity-related API operations.
171
247
  * Handles roles and users CRUD operations.
172
248
  *
173
- * Translated from @abp/ng.identity IdentityService v2.4.0
249
+ * Translated from @abp/ng.identity IdentityService v3.0.0
250
+ *
251
+ * @since 3.0.0 - Added getUserAssignableRoles method
174
252
  */
175
253
  declare class IdentityService {
176
254
  private rest;
@@ -236,6 +314,13 @@ declare class IdentityService {
236
314
  * @returns Promise with the user's roles
237
315
  */
238
316
  getUserRoles(id: string): Promise<Identity.RoleResponse>;
317
+ /**
318
+ * Get all roles that can be assigned to users.
319
+ * This returns the list of available roles for user assignment.
320
+ * @since 3.0.0
321
+ * @returns Promise with assignable roles
322
+ */
323
+ getUserAssignableRoles(): Promise<Identity.RoleResponse>;
239
324
  /**
240
325
  * Delete a user
241
326
  * @param id - The user ID to delete
@@ -705,4 +790,4 @@ declare const IDENTITY_POLICIES: {
705
790
  readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
706
791
  };
707
792
 
708
- export { IDENTITY_POLICIES, IDENTITY_ROUTE_PATHS, Identity, type IdentityComponentKey, type IdentityRouteNameKey, IdentityService, IdentityStateService, type PasswordRule, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, eIdentityComponents, eIdentityRouteNames, useIdentity, useRoles, useUsers };
793
+ export { IDENTITY_POLICIES, IDENTITY_ROUTE_PATHS, IDENTITY_ROUTE_PROVIDERS, Identity, type IdentityComponentKey, type IdentityPolicyNameKey, type IdentityRouteNameKey, IdentityService, IdentityStateService, type PasswordRule, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, configureRoutes, eIdentityComponents, eIdentityPolicyNames, eIdentityRouteNames, initializeIdentityRoutes, useIdentity, useRoles, useUsers };
package/dist/index.d.ts CHANGED
@@ -1,38 +1,43 @@
1
- import { ABP, RestService } from '@abpjs/core';
1
+ import { RoutesService, ABP, RestService } from '@abpjs/core';
2
2
  import React from 'react';
3
3
 
4
4
  /**
5
- * Component keys for the Identity module.
6
- * These keys are used for component replacement/customization.
7
- * @since 2.7.0
5
+ * Policy names for Identity module permissions.
6
+ * Used to check authorization for identity management operations.
7
+ *
8
+ * @since 3.0.0
8
9
  */
9
- declare const eIdentityComponents: {
10
+ declare const eIdentityPolicyNames: {
10
11
  /**
11
- * Key for the Roles component.
12
- * Use this to replace the default RolesComponent with a custom implementation.
12
+ * Combined policy for identity management (Roles OR Users).
13
+ * Use this for the main Identity Management menu item.
13
14
  */
14
- readonly Roles: "Identity.RolesComponent";
15
+ readonly IdentityManagement: "AbpIdentity.Roles || AbpIdentity.Users";
15
16
  /**
16
- * Key for the Users component.
17
- * Use this to replace the default UsersComponent with a custom implementation.
17
+ * Policy for role management.
18
18
  */
19
- readonly Users: "Identity.UsersComponent";
19
+ readonly Roles: "AbpIdentity.Roles";
20
+ /**
21
+ * Policy for user management.
22
+ */
23
+ readonly Users: "AbpIdentity.Users";
20
24
  };
21
25
  /**
22
- * Type for identity component key values
26
+ * Type for identity policy name values
23
27
  */
24
- type IdentityComponentKey = (typeof eIdentityComponents)[keyof typeof eIdentityComponents];
28
+ type IdentityPolicyNameKey = (typeof eIdentityPolicyNames)[keyof typeof eIdentityPolicyNames];
25
29
 
26
30
  /**
27
31
  * Route names for the Identity module.
28
32
  * These are used for navigation menu items and breadcrumbs.
29
- * @since 2.7.0
33
+ *
34
+ * @since 2.7.0 - Original location in lib/enums
35
+ * @since 3.0.0 - Moved to config/enums, removed Administration key
36
+ *
37
+ * Note: In v3.0.0, the Administration key was removed from this enum.
38
+ * The Administration menu item is now managed by @abpjs/core or individual modules.
30
39
  */
31
40
  declare const eIdentityRouteNames: {
32
- /**
33
- * Administration menu item name.
34
- */
35
- readonly Administration: "AbpUiNavigation::Menu:Administration";
36
41
  /**
37
42
  * Identity Management menu item name.
38
43
  */
@@ -51,6 +56,77 @@ declare const eIdentityRouteNames: {
51
56
  */
52
57
  type IdentityRouteNameKey = (typeof eIdentityRouteNames)[keyof typeof eIdentityRouteNames];
53
58
 
59
+ /**
60
+ * Route provider for Identity module.
61
+ * Provides route configuration for the identity management routes.
62
+ *
63
+ * @since 3.0.0
64
+ */
65
+
66
+ /**
67
+ * Configures the identity module routes.
68
+ * Returns a function that adds the routes to the RoutesService.
69
+ *
70
+ * @param routes - The RoutesService instance to add routes to
71
+ * @returns A function that adds the identity routes when called
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const routes = getRoutesService();
76
+ * const addRoutes = configureRoutes(routes);
77
+ * addRoutes();
78
+ * ```
79
+ */
80
+ declare function configureRoutes(routes: RoutesService): () => void;
81
+ /**
82
+ * Identity route providers configuration object.
83
+ * Use this to configure identity routes in your application.
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * // In your app initialization:
88
+ * const routes = getRoutesService();
89
+ * const addRoutes = IDENTITY_ROUTE_PROVIDERS.configureRoutes(routes);
90
+ * addRoutes();
91
+ * ```
92
+ */
93
+ declare const IDENTITY_ROUTE_PROVIDERS: {
94
+ configureRoutes: typeof configureRoutes;
95
+ };
96
+ /**
97
+ * Initializes the identity module routes using the global RoutesService.
98
+ * Call this function during application startup to register identity routes.
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * // In your app initialization:
103
+ * initializeIdentityRoutes();
104
+ * ```
105
+ */
106
+ declare function initializeIdentityRoutes(): void;
107
+
108
+ /**
109
+ * Component keys for the Identity module.
110
+ * These keys are used for component replacement/customization.
111
+ * @since 2.7.0
112
+ */
113
+ declare const eIdentityComponents: {
114
+ /**
115
+ * Key for the Roles component.
116
+ * Use this to replace the default RolesComponent with a custom implementation.
117
+ */
118
+ readonly Roles: "Identity.RolesComponent";
119
+ /**
120
+ * Key for the Users component.
121
+ * Use this to replace the default UsersComponent with a custom implementation.
122
+ */
123
+ readonly Users: "Identity.UsersComponent";
124
+ };
125
+ /**
126
+ * Type for identity component key values
127
+ */
128
+ type IdentityComponentKey = (typeof eIdentityComponents)[keyof typeof eIdentityComponents];
129
+
54
130
  /**
55
131
  * Identity namespace containing all types related to identity management.
56
132
  * Translated from @abp/ng.identity Identity namespace.
@@ -170,7 +246,9 @@ declare namespace Identity {
170
246
  * Service for managing identity-related API operations.
171
247
  * Handles roles and users CRUD operations.
172
248
  *
173
- * Translated from @abp/ng.identity IdentityService v2.4.0
249
+ * Translated from @abp/ng.identity IdentityService v3.0.0
250
+ *
251
+ * @since 3.0.0 - Added getUserAssignableRoles method
174
252
  */
175
253
  declare class IdentityService {
176
254
  private rest;
@@ -236,6 +314,13 @@ declare class IdentityService {
236
314
  * @returns Promise with the user's roles
237
315
  */
238
316
  getUserRoles(id: string): Promise<Identity.RoleResponse>;
317
+ /**
318
+ * Get all roles that can be assigned to users.
319
+ * This returns the list of available roles for user assignment.
320
+ * @since 3.0.0
321
+ * @returns Promise with assignable roles
322
+ */
323
+ getUserAssignableRoles(): Promise<Identity.RoleResponse>;
239
324
  /**
240
325
  * Delete a user
241
326
  * @param id - The user ID to delete
@@ -705,4 +790,4 @@ declare const IDENTITY_POLICIES: {
705
790
  readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
706
791
  };
707
792
 
708
- export { IDENTITY_POLICIES, IDENTITY_ROUTE_PATHS, Identity, type IdentityComponentKey, type IdentityRouteNameKey, IdentityService, IdentityStateService, type PasswordRule, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, eIdentityComponents, eIdentityRouteNames, useIdentity, useRoles, useUsers };
793
+ export { IDENTITY_POLICIES, IDENTITY_ROUTE_PATHS, IDENTITY_ROUTE_PROVIDERS, Identity, type IdentityComponentKey, type IdentityPolicyNameKey, type IdentityRouteNameKey, IdentityService, IdentityStateService, type PasswordRule, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, configureRoutes, eIdentityComponents, eIdentityPolicyNames, eIdentityRouteNames, initializeIdentityRoutes, useIdentity, useRoles, useUsers };
package/dist/index.js CHANGED
@@ -22,38 +22,41 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  IDENTITY_POLICIES: () => IDENTITY_POLICIES,
24
24
  IDENTITY_ROUTE_PATHS: () => IDENTITY_ROUTE_PATHS,
25
+ IDENTITY_ROUTE_PROVIDERS: () => IDENTITY_ROUTE_PROVIDERS,
25
26
  IdentityService: () => IdentityService,
26
27
  IdentityStateService: () => IdentityStateService,
27
28
  RolesComponent: () => RolesComponent,
28
29
  UsersComponent: () => UsersComponent,
30
+ configureRoutes: () => configureRoutes,
29
31
  eIdentityComponents: () => eIdentityComponents,
32
+ eIdentityPolicyNames: () => eIdentityPolicyNames,
30
33
  eIdentityRouteNames: () => eIdentityRouteNames,
34
+ initializeIdentityRoutes: () => initializeIdentityRoutes,
31
35
  useIdentity: () => useIdentity,
32
36
  useRoles: () => useRoles,
33
37
  useUsers: () => useUsers
34
38
  });
35
39
  module.exports = __toCommonJS(index_exports);
36
40
 
37
- // src/enums/components.ts
38
- var eIdentityComponents = {
41
+ // src/config/enums/policy-names.ts
42
+ var eIdentityPolicyNames = {
39
43
  /**
40
- * Key for the Roles component.
41
- * Use this to replace the default RolesComponent with a custom implementation.
44
+ * Combined policy for identity management (Roles OR Users).
45
+ * Use this for the main Identity Management menu item.
42
46
  */
43
- Roles: "Identity.RolesComponent",
47
+ IdentityManagement: "AbpIdentity.Roles || AbpIdentity.Users",
44
48
  /**
45
- * Key for the Users component.
46
- * Use this to replace the default UsersComponent with a custom implementation.
49
+ * Policy for role management.
47
50
  */
48
- Users: "Identity.UsersComponent"
51
+ Roles: "AbpIdentity.Roles",
52
+ /**
53
+ * Policy for user management.
54
+ */
55
+ Users: "AbpIdentity.Users"
49
56
  };
50
57
 
51
- // src/enums/route-names.ts
58
+ // src/config/enums/route-names.ts
52
59
  var eIdentityRouteNames = {
53
- /**
54
- * Administration menu item name.
55
- */
56
- Administration: "AbpUiNavigation::Menu:Administration",
57
60
  /**
58
61
  * Identity Management menu item name.
59
62
  */
@@ -68,6 +71,60 @@ var eIdentityRouteNames = {
68
71
  Users: "AbpIdentity::Users"
69
72
  };
70
73
 
74
+ // src/config/providers/route.provider.ts
75
+ var import_core = require("@abpjs/core");
76
+ function configureRoutes(routes) {
77
+ return () => {
78
+ routes.add([
79
+ {
80
+ path: "/identity",
81
+ name: eIdentityRouteNames.IdentityManagement,
82
+ parentName: "AbpUiNavigation::Menu:Administration",
83
+ requiredPolicy: eIdentityPolicyNames.IdentityManagement,
84
+ layout: import_core.eLayoutType.application,
85
+ iconClass: "bi bi-people",
86
+ order: 1
87
+ },
88
+ {
89
+ path: "/identity/roles",
90
+ name: eIdentityRouteNames.Roles,
91
+ parentName: eIdentityRouteNames.IdentityManagement,
92
+ requiredPolicy: eIdentityPolicyNames.Roles,
93
+ order: 1
94
+ },
95
+ {
96
+ path: "/identity/users",
97
+ name: eIdentityRouteNames.Users,
98
+ parentName: eIdentityRouteNames.IdentityManagement,
99
+ requiredPolicy: eIdentityPolicyNames.Users,
100
+ order: 2
101
+ }
102
+ ]);
103
+ };
104
+ }
105
+ var IDENTITY_ROUTE_PROVIDERS = {
106
+ configureRoutes
107
+ };
108
+ function initializeIdentityRoutes() {
109
+ const routes = (0, import_core.getRoutesService)();
110
+ const addRoutes = configureRoutes(routes);
111
+ addRoutes();
112
+ }
113
+
114
+ // src/enums/components.ts
115
+ var eIdentityComponents = {
116
+ /**
117
+ * Key for the Roles component.
118
+ * Use this to replace the default RolesComponent with a custom implementation.
119
+ */
120
+ Roles: "Identity.RolesComponent",
121
+ /**
122
+ * Key for the Users component.
123
+ * Use this to replace the default UsersComponent with a custom implementation.
124
+ */
125
+ Users: "Identity.UsersComponent"
126
+ };
127
+
71
128
  // src/services/identity.service.ts
72
129
  var IdentityService = class {
73
130
  constructor(rest) {
@@ -189,6 +246,18 @@ var IdentityService = class {
189
246
  url: `/api/identity/users/${id}/roles`
190
247
  });
191
248
  }
249
+ /**
250
+ * Get all roles that can be assigned to users.
251
+ * This returns the list of available roles for user assignment.
252
+ * @since 3.0.0
253
+ * @returns Promise with assignable roles
254
+ */
255
+ getUserAssignableRoles() {
256
+ return this.rest.request({
257
+ method: "GET",
258
+ url: "/api/identity/users/assignable-roles"
259
+ });
260
+ }
192
261
  /**
193
262
  * Delete a user
194
263
  * @param id - The user ID to delete
@@ -368,9 +437,9 @@ var IdentityStateService = class {
368
437
 
369
438
  // src/hooks/useRoles.ts
370
439
  var import_react = require("react");
371
- var import_core = require("@abpjs/core");
440
+ var import_core2 = require("@abpjs/core");
372
441
  function useRoles() {
373
- const restService = (0, import_core.useRestService)();
442
+ const restService = (0, import_core2.useRestService)();
374
443
  const service = (0, import_react.useMemo)(() => new IdentityService(restService), [restService]);
375
444
  const [roles, setRoles] = (0, import_react.useState)([]);
376
445
  const [totalCount, setTotalCount] = (0, import_react.useState)(0);
@@ -493,14 +562,14 @@ function useRoles() {
493
562
 
494
563
  // src/hooks/useUsers.ts
495
564
  var import_react2 = require("react");
496
- var import_core2 = require("@abpjs/core");
565
+ var import_core3 = require("@abpjs/core");
497
566
  var DEFAULT_PAGE_QUERY = {
498
567
  sorting: "userName",
499
568
  skipCount: 0,
500
569
  maxResultCount: 10
501
570
  };
502
571
  function useUsers() {
503
- const restService = (0, import_core2.useRestService)();
572
+ const restService = (0, import_core3.useRestService)();
504
573
  const service = (0, import_react2.useMemo)(() => new IdentityService(restService), [restService]);
505
574
  const [users, setUsers] = (0, import_react2.useState)([]);
506
575
  const [totalCount, setTotalCount] = (0, import_react2.useState)(0);
@@ -679,7 +748,7 @@ function useIdentity() {
679
748
 
680
749
  // src/components/Roles/RolesComponent.tsx
681
750
  var import_react4 = require("react");
682
- var import_core3 = require("@abpjs/core");
751
+ var import_core4 = require("@abpjs/core");
683
752
  var import_theme_shared = require("@abpjs/theme-shared");
684
753
  var import_permission_management = require("@abpjs/permission-management");
685
754
  var import_react5 = require("@chakra-ui/react");
@@ -695,7 +764,7 @@ function RolesComponent({
695
764
  onRoleDeleted,
696
765
  onVisiblePermissionChange
697
766
  }) {
698
- const { t } = (0, import_core3.useLocalization)();
767
+ const { t } = (0, import_core4.useLocalization)();
699
768
  const confirmation = (0, import_theme_shared.useConfirmation)();
700
769
  const {
701
770
  roles,
@@ -742,11 +811,13 @@ function RolesComponent({
742
811
  );
743
812
  (0, import_react4.useEffect)(() => {
744
813
  if (selectedRole) {
745
- setFormState({
746
- name: selectedRole.name || "",
747
- isDefault: selectedRole.isDefault || false,
748
- isPublic: selectedRole.isPublic || false
749
- });
814
+ queueMicrotask(
815
+ () => setFormState({
816
+ name: selectedRole.name || "",
817
+ isDefault: selectedRole.isDefault || false,
818
+ isPublic: selectedRole.isPublic || false
819
+ })
820
+ );
750
821
  }
751
822
  }, [selectedRole]);
752
823
  const handleDelete = (0, import_react4.useCallback)(
@@ -755,7 +826,7 @@ function RolesComponent({
755
826
  t("AbpIdentity::RoleDeletionConfirmationMessage", name),
756
827
  t("AbpIdentity::AreYouSure")
757
828
  );
758
- if (status === import_theme_shared.Toaster.Status.confirm) {
829
+ if (status === import_theme_shared.Confirmation.Status.confirm) {
759
830
  const result = await deleteRole(id);
760
831
  if (result.success) {
761
832
  onRoleDeleted?.(id);
@@ -914,7 +985,7 @@ RolesComponent.componentKey = eIdentityComponents.Roles;
914
985
 
915
986
  // src/components/Users/UsersComponent.tsx
916
987
  var import_react6 = require("react");
917
- var import_core4 = require("@abpjs/core");
988
+ var import_core5 = require("@abpjs/core");
918
989
  var import_theme_shared2 = require("@abpjs/theme-shared");
919
990
  var import_permission_management2 = require("@abpjs/permission-management");
920
991
  var import_react7 = require("@chakra-ui/react");
@@ -952,7 +1023,7 @@ function UsersComponent({
952
1023
  requiredPasswordLength = 0,
953
1024
  onVisiblePermissionChange
954
1025
  }) {
955
- const { t } = (0, import_core4.useLocalization)();
1026
+ const { t } = (0, import_core5.useLocalization)();
956
1027
  const confirmation = (0, import_theme_shared2.useConfirmation)();
957
1028
  const {
958
1029
  users,
@@ -1034,7 +1105,7 @@ function UsersComponent({
1034
1105
  t("AbpIdentity::UserDeletionConfirmationMessage", userName),
1035
1106
  t("AbpIdentity::AreYouSure")
1036
1107
  );
1037
- if (status === import_theme_shared2.Toaster.Status.confirm) {
1108
+ if (status === import_theme_shared2.Confirmation.Status.confirm) {
1038
1109
  const result = await deleteUser(id);
1039
1110
  if (result.success) {
1040
1111
  onUserDeleted?.(id);
@@ -1362,12 +1433,16 @@ var IDENTITY_POLICIES = {
1362
1433
  0 && (module.exports = {
1363
1434
  IDENTITY_POLICIES,
1364
1435
  IDENTITY_ROUTE_PATHS,
1436
+ IDENTITY_ROUTE_PROVIDERS,
1365
1437
  IdentityService,
1366
1438
  IdentityStateService,
1367
1439
  RolesComponent,
1368
1440
  UsersComponent,
1441
+ configureRoutes,
1369
1442
  eIdentityComponents,
1443
+ eIdentityPolicyNames,
1370
1444
  eIdentityRouteNames,
1445
+ initializeIdentityRoutes,
1371
1446
  useIdentity,
1372
1447
  useRoles,
1373
1448
  useUsers
package/dist/index.mjs CHANGED
@@ -1,23 +1,22 @@
1
- // src/enums/components.ts
2
- var eIdentityComponents = {
1
+ // src/config/enums/policy-names.ts
2
+ var eIdentityPolicyNames = {
3
3
  /**
4
- * Key for the Roles component.
5
- * Use this to replace the default RolesComponent with a custom implementation.
4
+ * Combined policy for identity management (Roles OR Users).
5
+ * Use this for the main Identity Management menu item.
6
6
  */
7
- Roles: "Identity.RolesComponent",
7
+ IdentityManagement: "AbpIdentity.Roles || AbpIdentity.Users",
8
8
  /**
9
- * Key for the Users component.
10
- * Use this to replace the default UsersComponent with a custom implementation.
9
+ * Policy for role management.
11
10
  */
12
- Users: "Identity.UsersComponent"
11
+ Roles: "AbpIdentity.Roles",
12
+ /**
13
+ * Policy for user management.
14
+ */
15
+ Users: "AbpIdentity.Users"
13
16
  };
14
17
 
15
- // src/enums/route-names.ts
18
+ // src/config/enums/route-names.ts
16
19
  var eIdentityRouteNames = {
17
- /**
18
- * Administration menu item name.
19
- */
20
- Administration: "AbpUiNavigation::Menu:Administration",
21
20
  /**
22
21
  * Identity Management menu item name.
23
22
  */
@@ -32,6 +31,60 @@ var eIdentityRouteNames = {
32
31
  Users: "AbpIdentity::Users"
33
32
  };
34
33
 
34
+ // src/config/providers/route.provider.ts
35
+ import { getRoutesService, eLayoutType } from "@abpjs/core";
36
+ function configureRoutes(routes) {
37
+ return () => {
38
+ routes.add([
39
+ {
40
+ path: "/identity",
41
+ name: eIdentityRouteNames.IdentityManagement,
42
+ parentName: "AbpUiNavigation::Menu:Administration",
43
+ requiredPolicy: eIdentityPolicyNames.IdentityManagement,
44
+ layout: eLayoutType.application,
45
+ iconClass: "bi bi-people",
46
+ order: 1
47
+ },
48
+ {
49
+ path: "/identity/roles",
50
+ name: eIdentityRouteNames.Roles,
51
+ parentName: eIdentityRouteNames.IdentityManagement,
52
+ requiredPolicy: eIdentityPolicyNames.Roles,
53
+ order: 1
54
+ },
55
+ {
56
+ path: "/identity/users",
57
+ name: eIdentityRouteNames.Users,
58
+ parentName: eIdentityRouteNames.IdentityManagement,
59
+ requiredPolicy: eIdentityPolicyNames.Users,
60
+ order: 2
61
+ }
62
+ ]);
63
+ };
64
+ }
65
+ var IDENTITY_ROUTE_PROVIDERS = {
66
+ configureRoutes
67
+ };
68
+ function initializeIdentityRoutes() {
69
+ const routes = getRoutesService();
70
+ const addRoutes = configureRoutes(routes);
71
+ addRoutes();
72
+ }
73
+
74
+ // src/enums/components.ts
75
+ var eIdentityComponents = {
76
+ /**
77
+ * Key for the Roles component.
78
+ * Use this to replace the default RolesComponent with a custom implementation.
79
+ */
80
+ Roles: "Identity.RolesComponent",
81
+ /**
82
+ * Key for the Users component.
83
+ * Use this to replace the default UsersComponent with a custom implementation.
84
+ */
85
+ Users: "Identity.UsersComponent"
86
+ };
87
+
35
88
  // src/services/identity.service.ts
36
89
  var IdentityService = class {
37
90
  constructor(rest) {
@@ -153,6 +206,18 @@ var IdentityService = class {
153
206
  url: `/api/identity/users/${id}/roles`
154
207
  });
155
208
  }
209
+ /**
210
+ * Get all roles that can be assigned to users.
211
+ * This returns the list of available roles for user assignment.
212
+ * @since 3.0.0
213
+ * @returns Promise with assignable roles
214
+ */
215
+ getUserAssignableRoles() {
216
+ return this.rest.request({
217
+ method: "GET",
218
+ url: "/api/identity/users/assignable-roles"
219
+ });
220
+ }
156
221
  /**
157
222
  * Delete a user
158
223
  * @param id - The user ID to delete
@@ -644,7 +709,7 @@ function useIdentity() {
644
709
  // src/components/Roles/RolesComponent.tsx
645
710
  import { useEffect, useState as useState3, useCallback as useCallback4 } from "react";
646
711
  import { useLocalization } from "@abpjs/core";
647
- import { Modal, useConfirmation, Toaster, Alert, Button, Checkbox, FormField } from "@abpjs/theme-shared";
712
+ import { Modal, useConfirmation, Confirmation, Alert, Button, Checkbox, FormField } from "@abpjs/theme-shared";
648
713
  import { PermissionManagementModal } from "@abpjs/permission-management";
649
714
  import {
650
715
  Box,
@@ -715,11 +780,13 @@ function RolesComponent({
715
780
  );
716
781
  useEffect(() => {
717
782
  if (selectedRole) {
718
- setFormState({
719
- name: selectedRole.name || "",
720
- isDefault: selectedRole.isDefault || false,
721
- isPublic: selectedRole.isPublic || false
722
- });
783
+ queueMicrotask(
784
+ () => setFormState({
785
+ name: selectedRole.name || "",
786
+ isDefault: selectedRole.isDefault || false,
787
+ isPublic: selectedRole.isPublic || false
788
+ })
789
+ );
723
790
  }
724
791
  }, [selectedRole]);
725
792
  const handleDelete = useCallback4(
@@ -728,7 +795,7 @@ function RolesComponent({
728
795
  t("AbpIdentity::RoleDeletionConfirmationMessage", name),
729
796
  t("AbpIdentity::AreYouSure")
730
797
  );
731
- if (status === Toaster.Status.confirm) {
798
+ if (status === Confirmation.Status.confirm) {
732
799
  const result = await deleteRole(id);
733
800
  if (result.success) {
734
801
  onRoleDeleted?.(id);
@@ -888,7 +955,7 @@ RolesComponent.componentKey = eIdentityComponents.Roles;
888
955
  // src/components/Users/UsersComponent.tsx
889
956
  import { useEffect as useEffect2, useState as useState4, useCallback as useCallback5, useMemo as useMemo4 } from "react";
890
957
  import { useLocalization as useLocalization2 } from "@abpjs/core";
891
- import { Modal as Modal2, useConfirmation as useConfirmation2, Toaster as Toaster2, Alert as Alert2, Button as Button2, Checkbox as Checkbox2, FormField as FormField2 } from "@abpjs/theme-shared";
958
+ import { Modal as Modal2, useConfirmation as useConfirmation2, Confirmation as Confirmation2, Alert as Alert2, Button as Button2, Checkbox as Checkbox2, FormField as FormField2 } from "@abpjs/theme-shared";
892
959
  import { PermissionManagementModal as PermissionManagementModal2 } from "@abpjs/permission-management";
893
960
  import {
894
961
  Box as Box2,
@@ -1018,7 +1085,7 @@ function UsersComponent({
1018
1085
  t("AbpIdentity::UserDeletionConfirmationMessage", userName),
1019
1086
  t("AbpIdentity::AreYouSure")
1020
1087
  );
1021
- if (status === Toaster2.Status.confirm) {
1088
+ if (status === Confirmation2.Status.confirm) {
1022
1089
  const result = await deleteUser(id);
1023
1090
  if (result.success) {
1024
1091
  onUserDeleted?.(id);
@@ -1345,12 +1412,16 @@ var IDENTITY_POLICIES = {
1345
1412
  export {
1346
1413
  IDENTITY_POLICIES,
1347
1414
  IDENTITY_ROUTE_PATHS,
1415
+ IDENTITY_ROUTE_PROVIDERS,
1348
1416
  IdentityService,
1349
1417
  IdentityStateService,
1350
1418
  RolesComponent,
1351
1419
  UsersComponent,
1420
+ configureRoutes,
1352
1421
  eIdentityComponents,
1422
+ eIdentityPolicyNames,
1353
1423
  eIdentityRouteNames,
1424
+ initializeIdentityRoutes,
1354
1425
  useIdentity,
1355
1426
  useRoles,
1356
1427
  useUsers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abpjs/identity",
3
- "version": "2.7.0",
3
+ "version": "3.0.0",
4
4
  "description": "ABP Framework identity components for React - translated from @abp/ng.identity",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -25,12 +25,12 @@
25
25
  "dependencies": {
26
26
  "@chakra-ui/react": "^3.2.0",
27
27
  "@emotion/react": "^11.11.0",
28
- "@abpjs/theme-shared": "2.7.0",
29
- "@abpjs/core": "2.7.0",
30
- "@abpjs/permission-management": "2.7.0"
28
+ "@abpjs/core": "3.0.0",
29
+ "@abpjs/theme-shared": "3.0.0",
30
+ "@abpjs/permission-management": "3.0.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@abp/ng.identity": "2.7.0",
33
+ "@abp/ng.identity": "3.0.0",
34
34
  "@testing-library/jest-dom": "^6.9.1",
35
35
  "@testing-library/react": "^14.0.0",
36
36
  "@testing-library/user-event": "^14.6.1",