@abpjs/identity-pro 2.1.1 → 2.4.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 +52 -1
- package/dist/index.d.ts +52 -1
- package/dist/index.js +92 -0
- package/dist/index.mjs +91 -0
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -144,6 +144,21 @@ declare namespace Identity {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Identity Pro Component Identifiers
|
|
149
|
+
* Translated from @volo/abp.ng.identity v2.4.0
|
|
150
|
+
*/
|
|
151
|
+
/**
|
|
152
|
+
* Enum for identity component identifiers.
|
|
153
|
+
* Used for component registration and identification.
|
|
154
|
+
* @since 2.4.0
|
|
155
|
+
*/
|
|
156
|
+
declare enum eIdentityComponents {
|
|
157
|
+
Claims = "Identity.ClaimsComponent",
|
|
158
|
+
Roles = "Identity.RolesComponent",
|
|
159
|
+
Users = "Identity.UsersComponent"
|
|
160
|
+
}
|
|
161
|
+
|
|
147
162
|
/**
|
|
148
163
|
* Service for managing identity-related API operations.
|
|
149
164
|
* Handles roles, users, and claim types CRUD operations.
|
|
@@ -156,6 +171,11 @@ declare namespace Identity {
|
|
|
156
171
|
* @since 2.0.0
|
|
157
172
|
*/
|
|
158
173
|
declare class IdentityService {
|
|
174
|
+
/**
|
|
175
|
+
* The API name used for REST requests.
|
|
176
|
+
* @since 2.4.0
|
|
177
|
+
*/
|
|
178
|
+
apiName: string;
|
|
159
179
|
private rest;
|
|
160
180
|
constructor(rest: RestService);
|
|
161
181
|
/**
|
|
@@ -164,6 +184,12 @@ declare class IdentityService {
|
|
|
164
184
|
* @returns Promise with paginated role response
|
|
165
185
|
*/
|
|
166
186
|
getRoles(params?: ABP.PageQueryParams): Promise<Identity.RoleResponse>;
|
|
187
|
+
/**
|
|
188
|
+
* Get all roles without pagination
|
|
189
|
+
* @since 2.4.0
|
|
190
|
+
* @returns Promise with all roles response
|
|
191
|
+
*/
|
|
192
|
+
getAllRoles(): Promise<Identity.RoleResponse>;
|
|
167
193
|
/**
|
|
168
194
|
* Get a role by ID
|
|
169
195
|
* @param id - The role ID
|
|
@@ -213,6 +239,13 @@ declare class IdentityService {
|
|
|
213
239
|
* @returns Promise resolving when complete
|
|
214
240
|
*/
|
|
215
241
|
deleteUser(id: string): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Unlock a locked out user
|
|
244
|
+
* @since 2.2.0
|
|
245
|
+
* @param id - The user ID to unlock
|
|
246
|
+
* @returns Promise resolving when complete
|
|
247
|
+
*/
|
|
248
|
+
unlockUser(id: string): Promise<void>;
|
|
216
249
|
/**
|
|
217
250
|
* Create a new user
|
|
218
251
|
* @param body - The user data to create
|
|
@@ -498,6 +531,10 @@ interface UseRolesReturn {
|
|
|
498
531
|
sortKey: string;
|
|
499
532
|
/** Current sort order @since 1.0.0 */
|
|
500
533
|
sortOrder: SortOrder;
|
|
534
|
+
/** Whether permissions modal is visible @since 2.2.0 */
|
|
535
|
+
visiblePermissions: boolean;
|
|
536
|
+
/** Provider key for permissions modal @since 2.2.0 */
|
|
537
|
+
permissionsProviderKey: string;
|
|
501
538
|
/** Fetch all roles with optional pagination/filtering */
|
|
502
539
|
fetchRoles: (params?: ABP.PageQueryParams) => Promise<RoleOperationResult>;
|
|
503
540
|
/** Get a role by ID and set it as selected */
|
|
@@ -514,6 +551,10 @@ interface UseRolesReturn {
|
|
|
514
551
|
setSortKey: (key: string) => void;
|
|
515
552
|
/** Set sort order @since 1.0.0 */
|
|
516
553
|
setSortOrder: (order: SortOrder) => void;
|
|
554
|
+
/** Handle permissions modal visibility change @since 2.2.0 */
|
|
555
|
+
onVisiblePermissionsChange: (value: boolean) => void;
|
|
556
|
+
/** Open permissions modal for a role @since 2.2.0 */
|
|
557
|
+
openPermissionsModal: (providerKey: string) => void;
|
|
517
558
|
/** Reset state */
|
|
518
559
|
reset: () => void;
|
|
519
560
|
}
|
|
@@ -586,6 +627,10 @@ interface UseUsersReturn {
|
|
|
586
627
|
sortKey: string;
|
|
587
628
|
/** Current sort order @since 1.0.0 */
|
|
588
629
|
sortOrder: SortOrder;
|
|
630
|
+
/** Whether permissions modal is visible @since 2.2.0 */
|
|
631
|
+
visiblePermissions: boolean;
|
|
632
|
+
/** Provider key for permissions modal @since 2.2.0 */
|
|
633
|
+
permissionsProviderKey: string;
|
|
589
634
|
/** Fetch users with pagination */
|
|
590
635
|
fetchUsers: (params?: ABP.PageQueryParams) => Promise<UserOperationResult>;
|
|
591
636
|
/** Get a user by ID and set it as selected */
|
|
@@ -598,6 +643,8 @@ interface UseUsersReturn {
|
|
|
598
643
|
updateUser: (id: string, user: Identity.UserSaveRequest) => Promise<UserOperationResult>;
|
|
599
644
|
/** Delete a user */
|
|
600
645
|
deleteUser: (id: string) => Promise<UserOperationResult>;
|
|
646
|
+
/** Unlock a locked out user @since 2.2.0 */
|
|
647
|
+
unlockUser: (id: string) => Promise<UserOperationResult>;
|
|
601
648
|
/** Set the selected user */
|
|
602
649
|
setSelectedUser: (user: Identity.UserItem | null) => void;
|
|
603
650
|
/** Set page query parameters */
|
|
@@ -606,6 +653,10 @@ interface UseUsersReturn {
|
|
|
606
653
|
setSortKey: (key: string) => void;
|
|
607
654
|
/** Set sort order @since 1.0.0 */
|
|
608
655
|
setSortOrder: (order: SortOrder) => void;
|
|
656
|
+
/** Handle permissions modal visibility change @since 2.2.0 */
|
|
657
|
+
onVisiblePermissionsChange: (value: boolean) => void;
|
|
658
|
+
/** Open permissions modal for a user @since 2.2.0 */
|
|
659
|
+
openPermissionsModal: (providerKey: string) => void;
|
|
609
660
|
/** Reset state */
|
|
610
661
|
reset: () => void;
|
|
611
662
|
}
|
|
@@ -980,4 +1031,4 @@ declare const IDENTITY_POLICIES: {
|
|
|
980
1031
|
readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
|
|
981
1032
|
};
|
|
982
1033
|
|
|
983
|
-
export { ClaimModal, type ClaimModalProps, type ClaimOperationResult, ClaimsComponent, type ClaimsComponentProps, IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, IdentityStateService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseClaimsReturn, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useClaims, useIdentity, useRoles, useUsers };
|
|
1034
|
+
export { ClaimModal, type ClaimModalProps, type ClaimOperationResult, ClaimsComponent, type ClaimsComponentProps, IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, IdentityStateService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseClaimsReturn, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, eIdentityComponents, useClaims, useIdentity, useRoles, useUsers };
|
package/dist/index.d.ts
CHANGED
|
@@ -144,6 +144,21 @@ declare namespace Identity {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Identity Pro Component Identifiers
|
|
149
|
+
* Translated from @volo/abp.ng.identity v2.4.0
|
|
150
|
+
*/
|
|
151
|
+
/**
|
|
152
|
+
* Enum for identity component identifiers.
|
|
153
|
+
* Used for component registration and identification.
|
|
154
|
+
* @since 2.4.0
|
|
155
|
+
*/
|
|
156
|
+
declare enum eIdentityComponents {
|
|
157
|
+
Claims = "Identity.ClaimsComponent",
|
|
158
|
+
Roles = "Identity.RolesComponent",
|
|
159
|
+
Users = "Identity.UsersComponent"
|
|
160
|
+
}
|
|
161
|
+
|
|
147
162
|
/**
|
|
148
163
|
* Service for managing identity-related API operations.
|
|
149
164
|
* Handles roles, users, and claim types CRUD operations.
|
|
@@ -156,6 +171,11 @@ declare namespace Identity {
|
|
|
156
171
|
* @since 2.0.0
|
|
157
172
|
*/
|
|
158
173
|
declare class IdentityService {
|
|
174
|
+
/**
|
|
175
|
+
* The API name used for REST requests.
|
|
176
|
+
* @since 2.4.0
|
|
177
|
+
*/
|
|
178
|
+
apiName: string;
|
|
159
179
|
private rest;
|
|
160
180
|
constructor(rest: RestService);
|
|
161
181
|
/**
|
|
@@ -164,6 +184,12 @@ declare class IdentityService {
|
|
|
164
184
|
* @returns Promise with paginated role response
|
|
165
185
|
*/
|
|
166
186
|
getRoles(params?: ABP.PageQueryParams): Promise<Identity.RoleResponse>;
|
|
187
|
+
/**
|
|
188
|
+
* Get all roles without pagination
|
|
189
|
+
* @since 2.4.0
|
|
190
|
+
* @returns Promise with all roles response
|
|
191
|
+
*/
|
|
192
|
+
getAllRoles(): Promise<Identity.RoleResponse>;
|
|
167
193
|
/**
|
|
168
194
|
* Get a role by ID
|
|
169
195
|
* @param id - The role ID
|
|
@@ -213,6 +239,13 @@ declare class IdentityService {
|
|
|
213
239
|
* @returns Promise resolving when complete
|
|
214
240
|
*/
|
|
215
241
|
deleteUser(id: string): Promise<void>;
|
|
242
|
+
/**
|
|
243
|
+
* Unlock a locked out user
|
|
244
|
+
* @since 2.2.0
|
|
245
|
+
* @param id - The user ID to unlock
|
|
246
|
+
* @returns Promise resolving when complete
|
|
247
|
+
*/
|
|
248
|
+
unlockUser(id: string): Promise<void>;
|
|
216
249
|
/**
|
|
217
250
|
* Create a new user
|
|
218
251
|
* @param body - The user data to create
|
|
@@ -498,6 +531,10 @@ interface UseRolesReturn {
|
|
|
498
531
|
sortKey: string;
|
|
499
532
|
/** Current sort order @since 1.0.0 */
|
|
500
533
|
sortOrder: SortOrder;
|
|
534
|
+
/** Whether permissions modal is visible @since 2.2.0 */
|
|
535
|
+
visiblePermissions: boolean;
|
|
536
|
+
/** Provider key for permissions modal @since 2.2.0 */
|
|
537
|
+
permissionsProviderKey: string;
|
|
501
538
|
/** Fetch all roles with optional pagination/filtering */
|
|
502
539
|
fetchRoles: (params?: ABP.PageQueryParams) => Promise<RoleOperationResult>;
|
|
503
540
|
/** Get a role by ID and set it as selected */
|
|
@@ -514,6 +551,10 @@ interface UseRolesReturn {
|
|
|
514
551
|
setSortKey: (key: string) => void;
|
|
515
552
|
/** Set sort order @since 1.0.0 */
|
|
516
553
|
setSortOrder: (order: SortOrder) => void;
|
|
554
|
+
/** Handle permissions modal visibility change @since 2.2.0 */
|
|
555
|
+
onVisiblePermissionsChange: (value: boolean) => void;
|
|
556
|
+
/** Open permissions modal for a role @since 2.2.0 */
|
|
557
|
+
openPermissionsModal: (providerKey: string) => void;
|
|
517
558
|
/** Reset state */
|
|
518
559
|
reset: () => void;
|
|
519
560
|
}
|
|
@@ -586,6 +627,10 @@ interface UseUsersReturn {
|
|
|
586
627
|
sortKey: string;
|
|
587
628
|
/** Current sort order @since 1.0.0 */
|
|
588
629
|
sortOrder: SortOrder;
|
|
630
|
+
/** Whether permissions modal is visible @since 2.2.0 */
|
|
631
|
+
visiblePermissions: boolean;
|
|
632
|
+
/** Provider key for permissions modal @since 2.2.0 */
|
|
633
|
+
permissionsProviderKey: string;
|
|
589
634
|
/** Fetch users with pagination */
|
|
590
635
|
fetchUsers: (params?: ABP.PageQueryParams) => Promise<UserOperationResult>;
|
|
591
636
|
/** Get a user by ID and set it as selected */
|
|
@@ -598,6 +643,8 @@ interface UseUsersReturn {
|
|
|
598
643
|
updateUser: (id: string, user: Identity.UserSaveRequest) => Promise<UserOperationResult>;
|
|
599
644
|
/** Delete a user */
|
|
600
645
|
deleteUser: (id: string) => Promise<UserOperationResult>;
|
|
646
|
+
/** Unlock a locked out user @since 2.2.0 */
|
|
647
|
+
unlockUser: (id: string) => Promise<UserOperationResult>;
|
|
601
648
|
/** Set the selected user */
|
|
602
649
|
setSelectedUser: (user: Identity.UserItem | null) => void;
|
|
603
650
|
/** Set page query parameters */
|
|
@@ -606,6 +653,10 @@ interface UseUsersReturn {
|
|
|
606
653
|
setSortKey: (key: string) => void;
|
|
607
654
|
/** Set sort order @since 1.0.0 */
|
|
608
655
|
setSortOrder: (order: SortOrder) => void;
|
|
656
|
+
/** Handle permissions modal visibility change @since 2.2.0 */
|
|
657
|
+
onVisiblePermissionsChange: (value: boolean) => void;
|
|
658
|
+
/** Open permissions modal for a user @since 2.2.0 */
|
|
659
|
+
openPermissionsModal: (providerKey: string) => void;
|
|
609
660
|
/** Reset state */
|
|
610
661
|
reset: () => void;
|
|
611
662
|
}
|
|
@@ -980,4 +1031,4 @@ declare const IDENTITY_POLICIES: {
|
|
|
980
1031
|
readonly ROLES_DELETE: "AbpIdentity.Roles.Delete";
|
|
981
1032
|
};
|
|
982
1033
|
|
|
983
|
-
export { ClaimModal, type ClaimModalProps, type ClaimOperationResult, ClaimsComponent, type ClaimsComponentProps, IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, IdentityStateService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseClaimsReturn, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, useClaims, useIdentity, useRoles, useUsers };
|
|
1034
|
+
export { ClaimModal, type ClaimModalProps, type ClaimOperationResult, ClaimsComponent, type ClaimsComponentProps, IDENTITY_POLICIES, IDENTITY_ROUTES, IDENTITY_ROUTE_PATHS, Identity, IdentityService, IdentityStateService, type RoleOperationResult, RolesComponent, type RolesComponentProps, type SortOrder, type UseClaimsReturn, type UseIdentityReturn, type UseRolesReturn, type UseUsersReturn, type UserOperationResult, UsersComponent, type UsersComponentProps, eIdentityComponents, useClaims, useIdentity, useRoles, useUsers };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ __export(index_exports, {
|
|
|
30
30
|
IdentityStateService: () => IdentityStateService,
|
|
31
31
|
RolesComponent: () => RolesComponent,
|
|
32
32
|
UsersComponent: () => UsersComponent,
|
|
33
|
+
eIdentityComponents: () => eIdentityComponents,
|
|
33
34
|
useClaims: () => useClaims,
|
|
34
35
|
useIdentity: () => useIdentity,
|
|
35
36
|
useRoles: () => useRoles,
|
|
@@ -49,9 +50,22 @@ var Identity;
|
|
|
49
50
|
})(ClaimValueType = Identity2.ClaimValueType || (Identity2.ClaimValueType = {}));
|
|
50
51
|
})(Identity || (Identity = {}));
|
|
51
52
|
|
|
53
|
+
// src/enums/components.ts
|
|
54
|
+
var eIdentityComponents = /* @__PURE__ */ ((eIdentityComponents2) => {
|
|
55
|
+
eIdentityComponents2["Claims"] = "Identity.ClaimsComponent";
|
|
56
|
+
eIdentityComponents2["Roles"] = "Identity.RolesComponent";
|
|
57
|
+
eIdentityComponents2["Users"] = "Identity.UsersComponent";
|
|
58
|
+
return eIdentityComponents2;
|
|
59
|
+
})(eIdentityComponents || {});
|
|
60
|
+
|
|
52
61
|
// src/services/identity.service.ts
|
|
53
62
|
var IdentityService = class {
|
|
54
63
|
constructor(rest) {
|
|
64
|
+
/**
|
|
65
|
+
* The API name used for REST requests.
|
|
66
|
+
* @since 2.4.0
|
|
67
|
+
*/
|
|
68
|
+
this.apiName = "default";
|
|
55
69
|
this.rest = rest;
|
|
56
70
|
}
|
|
57
71
|
// ========================
|
|
@@ -69,6 +83,17 @@ var IdentityService = class {
|
|
|
69
83
|
params
|
|
70
84
|
});
|
|
71
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Get all roles without pagination
|
|
88
|
+
* @since 2.4.0
|
|
89
|
+
* @returns Promise with all roles response
|
|
90
|
+
*/
|
|
91
|
+
getAllRoles() {
|
|
92
|
+
return this.rest.request({
|
|
93
|
+
method: "GET",
|
|
94
|
+
url: "/api/identity/roles/all"
|
|
95
|
+
});
|
|
96
|
+
}
|
|
72
97
|
/**
|
|
73
98
|
* Get a role by ID
|
|
74
99
|
* @param id - The role ID
|
|
@@ -164,6 +189,18 @@ var IdentityService = class {
|
|
|
164
189
|
url: `/api/identity/users/${id}`
|
|
165
190
|
});
|
|
166
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Unlock a locked out user
|
|
194
|
+
* @since 2.2.0
|
|
195
|
+
* @param id - The user ID to unlock
|
|
196
|
+
* @returns Promise resolving when complete
|
|
197
|
+
*/
|
|
198
|
+
unlockUser(id) {
|
|
199
|
+
return this.rest.request({
|
|
200
|
+
method: "PUT",
|
|
201
|
+
url: `/api/identity/users/${id}/unlock`
|
|
202
|
+
});
|
|
203
|
+
}
|
|
167
204
|
/**
|
|
168
205
|
* Create a new user
|
|
169
206
|
* @param body - The user data to create
|
|
@@ -560,6 +597,8 @@ function useRoles() {
|
|
|
560
597
|
const [error, setError] = (0, import_react.useState)(null);
|
|
561
598
|
const [sortKey, setSortKey] = (0, import_react.useState)("name");
|
|
562
599
|
const [sortOrder, setSortOrder] = (0, import_react.useState)("");
|
|
600
|
+
const [visiblePermissions, setVisiblePermissions] = (0, import_react.useState)(false);
|
|
601
|
+
const [permissionsProviderKey, setPermissionsProviderKey] = (0, import_react.useState)("");
|
|
563
602
|
const fetchRoles = (0, import_react.useCallback)(async (params) => {
|
|
564
603
|
setIsLoading(true);
|
|
565
604
|
setError(null);
|
|
@@ -645,12 +684,24 @@ function useRoles() {
|
|
|
645
684
|
},
|
|
646
685
|
[service, fetchRoles]
|
|
647
686
|
);
|
|
687
|
+
const onVisiblePermissionsChange = (0, import_react.useCallback)((value) => {
|
|
688
|
+
setVisiblePermissions(value);
|
|
689
|
+
if (!value) {
|
|
690
|
+
setPermissionsProviderKey("");
|
|
691
|
+
}
|
|
692
|
+
}, []);
|
|
693
|
+
const openPermissionsModal = (0, import_react.useCallback)((providerKey) => {
|
|
694
|
+
setPermissionsProviderKey(providerKey);
|
|
695
|
+
setVisiblePermissions(true);
|
|
696
|
+
}, []);
|
|
648
697
|
const reset = (0, import_react.useCallback)(() => {
|
|
649
698
|
setRoles([]);
|
|
650
699
|
setTotalCount(0);
|
|
651
700
|
setSelectedRole(null);
|
|
652
701
|
setIsLoading(false);
|
|
653
702
|
setError(null);
|
|
703
|
+
setVisiblePermissions(false);
|
|
704
|
+
setPermissionsProviderKey("");
|
|
654
705
|
}, []);
|
|
655
706
|
return {
|
|
656
707
|
roles,
|
|
@@ -660,6 +711,8 @@ function useRoles() {
|
|
|
660
711
|
error,
|
|
661
712
|
sortKey,
|
|
662
713
|
sortOrder,
|
|
714
|
+
visiblePermissions,
|
|
715
|
+
permissionsProviderKey,
|
|
663
716
|
fetchRoles,
|
|
664
717
|
getRoleById,
|
|
665
718
|
createRole,
|
|
@@ -668,6 +721,8 @@ function useRoles() {
|
|
|
668
721
|
setSelectedRole,
|
|
669
722
|
setSortKey,
|
|
670
723
|
setSortOrder,
|
|
724
|
+
onVisiblePermissionsChange,
|
|
725
|
+
openPermissionsModal,
|
|
671
726
|
reset
|
|
672
727
|
};
|
|
673
728
|
}
|
|
@@ -692,6 +747,8 @@ function useUsers() {
|
|
|
692
747
|
const [pageQuery, setPageQuery] = (0, import_react2.useState)(DEFAULT_PAGE_QUERY);
|
|
693
748
|
const [sortKey, setSortKey] = (0, import_react2.useState)("userName");
|
|
694
749
|
const [sortOrder, setSortOrder] = (0, import_react2.useState)("");
|
|
750
|
+
const [visiblePermissions, setVisiblePermissions] = (0, import_react2.useState)(false);
|
|
751
|
+
const [permissionsProviderKey, setPermissionsProviderKey] = (0, import_react2.useState)("");
|
|
695
752
|
const fetchUsers = (0, import_react2.useCallback)(
|
|
696
753
|
async (params) => {
|
|
697
754
|
setIsLoading(true);
|
|
@@ -799,6 +856,33 @@ function useUsers() {
|
|
|
799
856
|
},
|
|
800
857
|
[service, fetchUsers]
|
|
801
858
|
);
|
|
859
|
+
const unlockUser = (0, import_react2.useCallback)(
|
|
860
|
+
async (id) => {
|
|
861
|
+
setIsLoading(true);
|
|
862
|
+
setError(null);
|
|
863
|
+
try {
|
|
864
|
+
await service.unlockUser(id);
|
|
865
|
+
await fetchUsers();
|
|
866
|
+
return { success: true };
|
|
867
|
+
} catch (err) {
|
|
868
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to unlock user";
|
|
869
|
+
setError(errorMessage);
|
|
870
|
+
setIsLoading(false);
|
|
871
|
+
return { success: false, error: errorMessage };
|
|
872
|
+
}
|
|
873
|
+
},
|
|
874
|
+
[service, fetchUsers]
|
|
875
|
+
);
|
|
876
|
+
const onVisiblePermissionsChange = (0, import_react2.useCallback)((value) => {
|
|
877
|
+
setVisiblePermissions(value);
|
|
878
|
+
if (!value) {
|
|
879
|
+
setPermissionsProviderKey("");
|
|
880
|
+
}
|
|
881
|
+
}, []);
|
|
882
|
+
const openPermissionsModal = (0, import_react2.useCallback)((providerKey) => {
|
|
883
|
+
setPermissionsProviderKey(providerKey);
|
|
884
|
+
setVisiblePermissions(true);
|
|
885
|
+
}, []);
|
|
802
886
|
const reset = (0, import_react2.useCallback)(() => {
|
|
803
887
|
setUsers([]);
|
|
804
888
|
setTotalCount(0);
|
|
@@ -807,6 +891,8 @@ function useUsers() {
|
|
|
807
891
|
setIsLoading(false);
|
|
808
892
|
setError(null);
|
|
809
893
|
setPageQuery(DEFAULT_PAGE_QUERY);
|
|
894
|
+
setVisiblePermissions(false);
|
|
895
|
+
setPermissionsProviderKey("");
|
|
810
896
|
}, []);
|
|
811
897
|
return {
|
|
812
898
|
users,
|
|
@@ -818,16 +904,21 @@ function useUsers() {
|
|
|
818
904
|
pageQuery,
|
|
819
905
|
sortKey,
|
|
820
906
|
sortOrder,
|
|
907
|
+
visiblePermissions,
|
|
908
|
+
permissionsProviderKey,
|
|
821
909
|
fetchUsers,
|
|
822
910
|
getUserById,
|
|
823
911
|
getUserRoles,
|
|
824
912
|
createUser,
|
|
825
913
|
updateUser,
|
|
826
914
|
deleteUser,
|
|
915
|
+
unlockUser,
|
|
827
916
|
setSelectedUser,
|
|
828
917
|
setPageQuery,
|
|
829
918
|
setSortKey,
|
|
830
919
|
setSortOrder,
|
|
920
|
+
onVisiblePermissionsChange,
|
|
921
|
+
openPermissionsModal,
|
|
831
922
|
reset
|
|
832
923
|
};
|
|
833
924
|
}
|
|
@@ -2156,6 +2247,7 @@ var IDENTITY_POLICIES = {
|
|
|
2156
2247
|
IdentityStateService,
|
|
2157
2248
|
RolesComponent,
|
|
2158
2249
|
UsersComponent,
|
|
2250
|
+
eIdentityComponents,
|
|
2159
2251
|
useClaims,
|
|
2160
2252
|
useIdentity,
|
|
2161
2253
|
useRoles,
|
package/dist/index.mjs
CHANGED
|
@@ -10,9 +10,22 @@ var Identity;
|
|
|
10
10
|
})(ClaimValueType = Identity2.ClaimValueType || (Identity2.ClaimValueType = {}));
|
|
11
11
|
})(Identity || (Identity = {}));
|
|
12
12
|
|
|
13
|
+
// src/enums/components.ts
|
|
14
|
+
var eIdentityComponents = /* @__PURE__ */ ((eIdentityComponents2) => {
|
|
15
|
+
eIdentityComponents2["Claims"] = "Identity.ClaimsComponent";
|
|
16
|
+
eIdentityComponents2["Roles"] = "Identity.RolesComponent";
|
|
17
|
+
eIdentityComponents2["Users"] = "Identity.UsersComponent";
|
|
18
|
+
return eIdentityComponents2;
|
|
19
|
+
})(eIdentityComponents || {});
|
|
20
|
+
|
|
13
21
|
// src/services/identity.service.ts
|
|
14
22
|
var IdentityService = class {
|
|
15
23
|
constructor(rest) {
|
|
24
|
+
/**
|
|
25
|
+
* The API name used for REST requests.
|
|
26
|
+
* @since 2.4.0
|
|
27
|
+
*/
|
|
28
|
+
this.apiName = "default";
|
|
16
29
|
this.rest = rest;
|
|
17
30
|
}
|
|
18
31
|
// ========================
|
|
@@ -30,6 +43,17 @@ var IdentityService = class {
|
|
|
30
43
|
params
|
|
31
44
|
});
|
|
32
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Get all roles without pagination
|
|
48
|
+
* @since 2.4.0
|
|
49
|
+
* @returns Promise with all roles response
|
|
50
|
+
*/
|
|
51
|
+
getAllRoles() {
|
|
52
|
+
return this.rest.request({
|
|
53
|
+
method: "GET",
|
|
54
|
+
url: "/api/identity/roles/all"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
33
57
|
/**
|
|
34
58
|
* Get a role by ID
|
|
35
59
|
* @param id - The role ID
|
|
@@ -125,6 +149,18 @@ var IdentityService = class {
|
|
|
125
149
|
url: `/api/identity/users/${id}`
|
|
126
150
|
});
|
|
127
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Unlock a locked out user
|
|
154
|
+
* @since 2.2.0
|
|
155
|
+
* @param id - The user ID to unlock
|
|
156
|
+
* @returns Promise resolving when complete
|
|
157
|
+
*/
|
|
158
|
+
unlockUser(id) {
|
|
159
|
+
return this.rest.request({
|
|
160
|
+
method: "PUT",
|
|
161
|
+
url: `/api/identity/users/${id}/unlock`
|
|
162
|
+
});
|
|
163
|
+
}
|
|
128
164
|
/**
|
|
129
165
|
* Create a new user
|
|
130
166
|
* @param body - The user data to create
|
|
@@ -521,6 +557,8 @@ function useRoles() {
|
|
|
521
557
|
const [error, setError] = useState(null);
|
|
522
558
|
const [sortKey, setSortKey] = useState("name");
|
|
523
559
|
const [sortOrder, setSortOrder] = useState("");
|
|
560
|
+
const [visiblePermissions, setVisiblePermissions] = useState(false);
|
|
561
|
+
const [permissionsProviderKey, setPermissionsProviderKey] = useState("");
|
|
524
562
|
const fetchRoles = useCallback(async (params) => {
|
|
525
563
|
setIsLoading(true);
|
|
526
564
|
setError(null);
|
|
@@ -606,12 +644,24 @@ function useRoles() {
|
|
|
606
644
|
},
|
|
607
645
|
[service, fetchRoles]
|
|
608
646
|
);
|
|
647
|
+
const onVisiblePermissionsChange = useCallback((value) => {
|
|
648
|
+
setVisiblePermissions(value);
|
|
649
|
+
if (!value) {
|
|
650
|
+
setPermissionsProviderKey("");
|
|
651
|
+
}
|
|
652
|
+
}, []);
|
|
653
|
+
const openPermissionsModal = useCallback((providerKey) => {
|
|
654
|
+
setPermissionsProviderKey(providerKey);
|
|
655
|
+
setVisiblePermissions(true);
|
|
656
|
+
}, []);
|
|
609
657
|
const reset = useCallback(() => {
|
|
610
658
|
setRoles([]);
|
|
611
659
|
setTotalCount(0);
|
|
612
660
|
setSelectedRole(null);
|
|
613
661
|
setIsLoading(false);
|
|
614
662
|
setError(null);
|
|
663
|
+
setVisiblePermissions(false);
|
|
664
|
+
setPermissionsProviderKey("");
|
|
615
665
|
}, []);
|
|
616
666
|
return {
|
|
617
667
|
roles,
|
|
@@ -621,6 +671,8 @@ function useRoles() {
|
|
|
621
671
|
error,
|
|
622
672
|
sortKey,
|
|
623
673
|
sortOrder,
|
|
674
|
+
visiblePermissions,
|
|
675
|
+
permissionsProviderKey,
|
|
624
676
|
fetchRoles,
|
|
625
677
|
getRoleById,
|
|
626
678
|
createRole,
|
|
@@ -629,6 +681,8 @@ function useRoles() {
|
|
|
629
681
|
setSelectedRole,
|
|
630
682
|
setSortKey,
|
|
631
683
|
setSortOrder,
|
|
684
|
+
onVisiblePermissionsChange,
|
|
685
|
+
openPermissionsModal,
|
|
632
686
|
reset
|
|
633
687
|
};
|
|
634
688
|
}
|
|
@@ -653,6 +707,8 @@ function useUsers() {
|
|
|
653
707
|
const [pageQuery, setPageQuery] = useState2(DEFAULT_PAGE_QUERY);
|
|
654
708
|
const [sortKey, setSortKey] = useState2("userName");
|
|
655
709
|
const [sortOrder, setSortOrder] = useState2("");
|
|
710
|
+
const [visiblePermissions, setVisiblePermissions] = useState2(false);
|
|
711
|
+
const [permissionsProviderKey, setPermissionsProviderKey] = useState2("");
|
|
656
712
|
const fetchUsers = useCallback2(
|
|
657
713
|
async (params) => {
|
|
658
714
|
setIsLoading(true);
|
|
@@ -760,6 +816,33 @@ function useUsers() {
|
|
|
760
816
|
},
|
|
761
817
|
[service, fetchUsers]
|
|
762
818
|
);
|
|
819
|
+
const unlockUser = useCallback2(
|
|
820
|
+
async (id) => {
|
|
821
|
+
setIsLoading(true);
|
|
822
|
+
setError(null);
|
|
823
|
+
try {
|
|
824
|
+
await service.unlockUser(id);
|
|
825
|
+
await fetchUsers();
|
|
826
|
+
return { success: true };
|
|
827
|
+
} catch (err) {
|
|
828
|
+
const errorMessage = err instanceof Error ? err.message : "Failed to unlock user";
|
|
829
|
+
setError(errorMessage);
|
|
830
|
+
setIsLoading(false);
|
|
831
|
+
return { success: false, error: errorMessage };
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
[service, fetchUsers]
|
|
835
|
+
);
|
|
836
|
+
const onVisiblePermissionsChange = useCallback2((value) => {
|
|
837
|
+
setVisiblePermissions(value);
|
|
838
|
+
if (!value) {
|
|
839
|
+
setPermissionsProviderKey("");
|
|
840
|
+
}
|
|
841
|
+
}, []);
|
|
842
|
+
const openPermissionsModal = useCallback2((providerKey) => {
|
|
843
|
+
setPermissionsProviderKey(providerKey);
|
|
844
|
+
setVisiblePermissions(true);
|
|
845
|
+
}, []);
|
|
763
846
|
const reset = useCallback2(() => {
|
|
764
847
|
setUsers([]);
|
|
765
848
|
setTotalCount(0);
|
|
@@ -768,6 +851,8 @@ function useUsers() {
|
|
|
768
851
|
setIsLoading(false);
|
|
769
852
|
setError(null);
|
|
770
853
|
setPageQuery(DEFAULT_PAGE_QUERY);
|
|
854
|
+
setVisiblePermissions(false);
|
|
855
|
+
setPermissionsProviderKey("");
|
|
771
856
|
}, []);
|
|
772
857
|
return {
|
|
773
858
|
users,
|
|
@@ -779,16 +864,21 @@ function useUsers() {
|
|
|
779
864
|
pageQuery,
|
|
780
865
|
sortKey,
|
|
781
866
|
sortOrder,
|
|
867
|
+
visiblePermissions,
|
|
868
|
+
permissionsProviderKey,
|
|
782
869
|
fetchUsers,
|
|
783
870
|
getUserById,
|
|
784
871
|
getUserRoles,
|
|
785
872
|
createUser,
|
|
786
873
|
updateUser,
|
|
787
874
|
deleteUser,
|
|
875
|
+
unlockUser,
|
|
788
876
|
setSelectedUser,
|
|
789
877
|
setPageQuery,
|
|
790
878
|
setSortKey,
|
|
791
879
|
setSortOrder,
|
|
880
|
+
onVisiblePermissionsChange,
|
|
881
|
+
openPermissionsModal,
|
|
792
882
|
reset
|
|
793
883
|
};
|
|
794
884
|
}
|
|
@@ -2154,6 +2244,7 @@ export {
|
|
|
2154
2244
|
IdentityStateService,
|
|
2155
2245
|
RolesComponent,
|
|
2156
2246
|
UsersComponent,
|
|
2247
|
+
eIdentityComponents,
|
|
2157
2248
|
useClaims,
|
|
2158
2249
|
useIdentity,
|
|
2159
2250
|
useRoles,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abpjs/identity-pro",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "ABP Framework identity pro components for React - translated from @volo/abp.ng.identity",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"@chakra-ui/react": "^3.2.0",
|
|
28
28
|
"@emotion/react": "^11.11.0",
|
|
29
29
|
"react-icons": "^5.3.0",
|
|
30
|
-
"@abpjs/
|
|
31
|
-
"@abpjs/
|
|
32
|
-
"@abpjs/permission-management": "2.
|
|
30
|
+
"@abpjs/core": "2.4.0",
|
|
31
|
+
"@abpjs/theme-shared": "2.4.0",
|
|
32
|
+
"@abpjs/permission-management": "2.4.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@volo/abp.ng.identity": "2.
|
|
35
|
+
"@volo/abp.ng.identity": "2.4.0",
|
|
36
36
|
"@testing-library/jest-dom": "^6.9.1",
|
|
37
37
|
"@testing-library/react": "^14.0.0",
|
|
38
38
|
"@testing-library/user-event": "^14.6.1",
|