@abpjs/identity 3.1.0 → 4.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 +402 -166
- package/dist/index.d.ts +402 -166
- package/dist/index.js +358 -217
- package/dist/index.mjs +354 -216
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -23,8 +23,11 @@ __export(index_exports, {
|
|
|
23
23
|
IDENTITY_POLICIES: () => IDENTITY_POLICIES,
|
|
24
24
|
IDENTITY_ROUTE_PATHS: () => IDENTITY_ROUTE_PATHS,
|
|
25
25
|
IDENTITY_ROUTE_PROVIDERS: () => IDENTITY_ROUTE_PROVIDERS,
|
|
26
|
-
|
|
26
|
+
IdentityRoleService: () => IdentityRoleService,
|
|
27
27
|
IdentityStateService: () => IdentityStateService,
|
|
28
|
+
IdentityUserLookupService: () => IdentityUserLookupService,
|
|
29
|
+
IdentityUserService: () => IdentityUserService,
|
|
30
|
+
ProfileService: () => ProfileService,
|
|
28
31
|
RolesComponent: () => RolesComponent,
|
|
29
32
|
UsersComponent: () => UsersComponent,
|
|
30
33
|
configureRoutes: () => configureRoutes,
|
|
@@ -73,9 +76,9 @@ var eIdentityRouteNames = {
|
|
|
73
76
|
|
|
74
77
|
// src/config/providers/route.provider.ts
|
|
75
78
|
var import_core = require("@abpjs/core");
|
|
76
|
-
function configureRoutes(
|
|
79
|
+
function configureRoutes(routesService) {
|
|
77
80
|
return () => {
|
|
78
|
-
|
|
81
|
+
routesService.add([
|
|
79
82
|
{
|
|
80
83
|
path: "/identity",
|
|
81
84
|
name: eIdentityRouteNames.IdentityManagement,
|
|
@@ -106,8 +109,8 @@ var IDENTITY_ROUTE_PROVIDERS = {
|
|
|
106
109
|
configureRoutes
|
|
107
110
|
};
|
|
108
111
|
function initializeIdentityRoutes() {
|
|
109
|
-
const
|
|
110
|
-
const addRoutes = configureRoutes(
|
|
112
|
+
const routesService = (0, import_core.getRoutesService)();
|
|
113
|
+
const addRoutes = configureRoutes(routesService);
|
|
111
114
|
addRoutes();
|
|
112
115
|
}
|
|
113
116
|
|
|
@@ -125,192 +128,331 @@ var eIdentityComponents = {
|
|
|
125
128
|
Users: "Identity.UsersComponent"
|
|
126
129
|
};
|
|
127
130
|
|
|
128
|
-
// src/
|
|
129
|
-
var
|
|
130
|
-
constructor(
|
|
131
|
+
// src/proxy/identity/identity-role.service.ts
|
|
132
|
+
var IdentityRoleService = class {
|
|
133
|
+
constructor(restService) {
|
|
131
134
|
/**
|
|
132
135
|
* The API name used for REST requests.
|
|
133
|
-
* @since 2.4.0
|
|
134
136
|
*/
|
|
135
137
|
this.apiName = "default";
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
return this.rest.request({
|
|
207
|
-
method: "PUT",
|
|
208
|
-
url: `/api/identity/roles/${id}`,
|
|
209
|
-
body
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
// ========================
|
|
213
|
-
// User Operations
|
|
214
|
-
// ========================
|
|
215
|
-
/**
|
|
216
|
-
* Get users with pagination and filtering
|
|
217
|
-
* @param params - Query parameters for pagination and filtering
|
|
218
|
-
* @returns Promise with paginated user response
|
|
219
|
-
*/
|
|
220
|
-
getUsers(params = {}) {
|
|
221
|
-
return this.rest.request({
|
|
222
|
-
method: "GET",
|
|
223
|
-
url: "/api/identity/users",
|
|
224
|
-
params
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Get a user by ID
|
|
229
|
-
* @param id - The user ID
|
|
230
|
-
* @returns Promise with the user item
|
|
231
|
-
*/
|
|
232
|
-
getUserById(id) {
|
|
233
|
-
return this.rest.request({
|
|
234
|
-
method: "GET",
|
|
235
|
-
url: `/api/identity/users/${id}`
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Get roles assigned to a user
|
|
240
|
-
* @param id - The user ID
|
|
241
|
-
* @returns Promise with the user's roles
|
|
242
|
-
*/
|
|
243
|
-
getUserRoles(id) {
|
|
244
|
-
return this.rest.request({
|
|
245
|
-
method: "GET",
|
|
246
|
-
url: `/api/identity/users/${id}/roles`
|
|
247
|
-
});
|
|
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
|
-
});
|
|
138
|
+
/**
|
|
139
|
+
* Create a new role
|
|
140
|
+
* @param input - The role data to create
|
|
141
|
+
* @returns Promise with the created role
|
|
142
|
+
*/
|
|
143
|
+
this.create = (input) => {
|
|
144
|
+
return this.restService.request({
|
|
145
|
+
method: "POST",
|
|
146
|
+
url: "/api/identity/roles",
|
|
147
|
+
body: input
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Delete a role by ID
|
|
152
|
+
* @param id - The role ID to delete
|
|
153
|
+
* @returns Promise that resolves when deletion is complete
|
|
154
|
+
*/
|
|
155
|
+
this.delete = (id) => {
|
|
156
|
+
return this.restService.request({
|
|
157
|
+
method: "DELETE",
|
|
158
|
+
url: `/api/identity/roles/${id}`
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Get a role by ID
|
|
163
|
+
* @param id - The role ID
|
|
164
|
+
* @returns Promise with the role
|
|
165
|
+
*/
|
|
166
|
+
this.get = (id) => {
|
|
167
|
+
return this.restService.request({
|
|
168
|
+
method: "GET",
|
|
169
|
+
url: `/api/identity/roles/${id}`
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Get all roles without pagination
|
|
174
|
+
* @returns Promise with all roles
|
|
175
|
+
*/
|
|
176
|
+
this.getAllList = () => {
|
|
177
|
+
return this.restService.request({
|
|
178
|
+
method: "GET",
|
|
179
|
+
url: "/api/identity/roles/all"
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Get roles with pagination
|
|
184
|
+
* @param input - Pagination and sorting parameters
|
|
185
|
+
* @returns Promise with paginated roles
|
|
186
|
+
*/
|
|
187
|
+
this.getList = (input) => {
|
|
188
|
+
return this.restService.request({
|
|
189
|
+
method: "GET",
|
|
190
|
+
url: "/api/identity/roles",
|
|
191
|
+
params: input
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Update a role
|
|
196
|
+
* @param id - The role ID to update
|
|
197
|
+
* @param input - The updated role data
|
|
198
|
+
* @returns Promise with the updated role
|
|
199
|
+
*/
|
|
200
|
+
this.update = (id, input) => {
|
|
201
|
+
return this.restService.request({
|
|
202
|
+
method: "PUT",
|
|
203
|
+
url: `/api/identity/roles/${id}`,
|
|
204
|
+
body: input
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
this.restService = restService;
|
|
260
208
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// src/proxy/identity/identity-user-lookup.service.ts
|
|
212
|
+
var IdentityUserLookupService = class {
|
|
213
|
+
constructor(restService) {
|
|
214
|
+
/**
|
|
215
|
+
* The API name used for REST requests.
|
|
216
|
+
*/
|
|
217
|
+
this.apiName = "default";
|
|
218
|
+
/**
|
|
219
|
+
* Find a user by ID
|
|
220
|
+
* @param id - The user ID
|
|
221
|
+
* @returns Promise with the user data
|
|
222
|
+
*/
|
|
223
|
+
this.findById = (id) => {
|
|
224
|
+
return this.restService.request({
|
|
225
|
+
method: "GET",
|
|
226
|
+
url: `/api/identity/users/lookup/${id}`
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Find a user by username
|
|
231
|
+
* @param userName - The username to search for
|
|
232
|
+
* @returns Promise with the user data
|
|
233
|
+
*/
|
|
234
|
+
this.findByUserName = (userName) => {
|
|
235
|
+
return this.restService.request({
|
|
236
|
+
method: "GET",
|
|
237
|
+
url: `/api/identity/users/lookup/by-username/${userName}`
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Get count of users matching filter
|
|
242
|
+
* @param input - Filter parameters
|
|
243
|
+
* @returns Promise with the count
|
|
244
|
+
*/
|
|
245
|
+
this.getCount = (input) => {
|
|
246
|
+
return this.restService.request({
|
|
247
|
+
method: "GET",
|
|
248
|
+
url: "/api/identity/users/lookup/count",
|
|
249
|
+
params: input
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Search for users
|
|
254
|
+
* @param input - Search and pagination parameters
|
|
255
|
+
* @returns Promise with matching users
|
|
256
|
+
*/
|
|
257
|
+
this.search = (input) => {
|
|
258
|
+
return this.restService.request({
|
|
259
|
+
method: "GET",
|
|
260
|
+
url: "/api/identity/users/lookup/search",
|
|
261
|
+
params: input
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
this.restService = restService;
|
|
271
265
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// src/proxy/identity/identity-user.service.ts
|
|
269
|
+
var IdentityUserService = class {
|
|
270
|
+
constructor(restService) {
|
|
271
|
+
/**
|
|
272
|
+
* The API name used for REST requests.
|
|
273
|
+
*/
|
|
274
|
+
this.apiName = "default";
|
|
275
|
+
/**
|
|
276
|
+
* Create a new user
|
|
277
|
+
* @param input - The user data to create
|
|
278
|
+
* @returns Promise with the created user
|
|
279
|
+
*/
|
|
280
|
+
this.create = (input) => {
|
|
281
|
+
return this.restService.request({
|
|
282
|
+
method: "POST",
|
|
283
|
+
url: "/api/identity/users",
|
|
284
|
+
body: input
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* Delete a user by ID
|
|
289
|
+
* @param id - The user ID to delete
|
|
290
|
+
* @returns Promise that resolves when deletion is complete
|
|
291
|
+
*/
|
|
292
|
+
this.delete = (id) => {
|
|
293
|
+
return this.restService.request({
|
|
294
|
+
method: "DELETE",
|
|
295
|
+
url: `/api/identity/users/${id}`
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Find a user by email
|
|
300
|
+
* @param email - The user's email
|
|
301
|
+
* @returns Promise with the user
|
|
302
|
+
*/
|
|
303
|
+
this.findByEmail = (email) => {
|
|
304
|
+
return this.restService.request({
|
|
305
|
+
method: "GET",
|
|
306
|
+
url: `/api/identity/users/by-email/${email}`
|
|
307
|
+
});
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Find a user by username
|
|
311
|
+
* @param username - The user's username
|
|
312
|
+
* @returns Promise with the user
|
|
313
|
+
*/
|
|
314
|
+
this.findByUsername = (username) => {
|
|
315
|
+
return this.restService.request({
|
|
316
|
+
method: "GET",
|
|
317
|
+
url: `/api/identity/users/by-username/${username}`
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Get a user by ID
|
|
322
|
+
* @param id - The user ID
|
|
323
|
+
* @returns Promise with the user
|
|
324
|
+
*/
|
|
325
|
+
this.get = (id) => {
|
|
326
|
+
return this.restService.request({
|
|
327
|
+
method: "GET",
|
|
328
|
+
url: `/api/identity/users/${id}`
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* Get all roles that can be assigned to users
|
|
333
|
+
* @returns Promise with assignable roles
|
|
334
|
+
*/
|
|
335
|
+
this.getAssignableRoles = () => {
|
|
336
|
+
return this.restService.request({
|
|
337
|
+
method: "GET",
|
|
338
|
+
url: "/api/identity/users/assignable-roles"
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* Get users with pagination and filtering
|
|
343
|
+
* @param input - Pagination, sorting, and filter parameters
|
|
344
|
+
* @returns Promise with paginated users
|
|
345
|
+
*/
|
|
346
|
+
this.getList = (input) => {
|
|
347
|
+
return this.restService.request({
|
|
348
|
+
method: "GET",
|
|
349
|
+
url: "/api/identity/users",
|
|
350
|
+
params: input
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
/**
|
|
354
|
+
* Get roles assigned to a user
|
|
355
|
+
* @param id - The user ID
|
|
356
|
+
* @returns Promise with the user's roles
|
|
357
|
+
*/
|
|
358
|
+
this.getRoles = (id) => {
|
|
359
|
+
return this.restService.request({
|
|
360
|
+
method: "GET",
|
|
361
|
+
url: `/api/identity/users/${id}/roles`
|
|
362
|
+
});
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* Update a user
|
|
366
|
+
* @param id - The user ID to update
|
|
367
|
+
* @param input - The updated user data
|
|
368
|
+
* @returns Promise with the updated user
|
|
369
|
+
*/
|
|
370
|
+
this.update = (id, input) => {
|
|
371
|
+
return this.restService.request({
|
|
372
|
+
method: "PUT",
|
|
373
|
+
url: `/api/identity/users/${id}`,
|
|
374
|
+
body: input
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
/**
|
|
378
|
+
* Update a user's roles
|
|
379
|
+
* @param id - The user ID
|
|
380
|
+
* @param input - The new role assignments
|
|
381
|
+
* @returns Promise that resolves when update is complete
|
|
382
|
+
*/
|
|
383
|
+
this.updateRoles = (id, input) => {
|
|
384
|
+
return this.restService.request({
|
|
385
|
+
method: "PUT",
|
|
386
|
+
url: `/api/identity/users/${id}/roles`,
|
|
387
|
+
body: input
|
|
388
|
+
});
|
|
389
|
+
};
|
|
390
|
+
this.restService = restService;
|
|
283
391
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
// src/proxy/identity/profile.service.ts
|
|
395
|
+
var ProfileService = class {
|
|
396
|
+
constructor(restService) {
|
|
397
|
+
/**
|
|
398
|
+
* The API name used for REST requests.
|
|
399
|
+
*/
|
|
400
|
+
this.apiName = "default";
|
|
401
|
+
/**
|
|
402
|
+
* Change the current user's password
|
|
403
|
+
* @param input - Current and new password
|
|
404
|
+
* @returns Promise that resolves when password is changed
|
|
405
|
+
*/
|
|
406
|
+
this.changePassword = (input) => {
|
|
407
|
+
return this.restService.request({
|
|
408
|
+
method: "POST",
|
|
409
|
+
url: "/api/identity/my-profile/change-password",
|
|
410
|
+
body: input
|
|
411
|
+
});
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Get the current user's profile
|
|
415
|
+
* @returns Promise with the profile data
|
|
416
|
+
*/
|
|
417
|
+
this.get = () => {
|
|
418
|
+
return this.restService.request({
|
|
419
|
+
method: "GET",
|
|
420
|
+
url: "/api/identity/my-profile"
|
|
421
|
+
});
|
|
422
|
+
};
|
|
423
|
+
/**
|
|
424
|
+
* Update the current user's profile
|
|
425
|
+
* @param input - Updated profile data
|
|
426
|
+
* @returns Promise with the updated profile
|
|
427
|
+
*/
|
|
428
|
+
this.update = (input) => {
|
|
429
|
+
return this.restService.request({
|
|
430
|
+
method: "PUT",
|
|
431
|
+
url: "/api/identity/my-profile",
|
|
432
|
+
body: input
|
|
433
|
+
});
|
|
434
|
+
};
|
|
435
|
+
this.restService = restService;
|
|
296
436
|
}
|
|
297
437
|
};
|
|
298
438
|
|
|
299
439
|
// src/services/identity-state.service.ts
|
|
300
440
|
var IdentityStateService = class {
|
|
301
|
-
constructor(
|
|
441
|
+
constructor(identityRoleService, identityUserService) {
|
|
302
442
|
// Internal state
|
|
303
443
|
this.roles = [];
|
|
304
444
|
this.rolesTotalCount = 0;
|
|
305
445
|
this.users = [];
|
|
306
446
|
this.usersTotalCount = 0;
|
|
307
|
-
this.
|
|
447
|
+
this.identityRoleService = identityRoleService;
|
|
448
|
+
this.identityUserService = identityUserService;
|
|
308
449
|
}
|
|
309
450
|
// ========================
|
|
310
451
|
// State Getters
|
|
311
452
|
// ========================
|
|
312
453
|
/**
|
|
313
454
|
* Get the current roles from state
|
|
455
|
+
* @updated 4.0.0 - Returns IdentityRoleDto[] instead of Identity.RoleItem[]
|
|
314
456
|
*/
|
|
315
457
|
getRoles() {
|
|
316
458
|
return this.roles;
|
|
@@ -323,6 +465,7 @@ var IdentityStateService = class {
|
|
|
323
465
|
}
|
|
324
466
|
/**
|
|
325
467
|
* Get the current users from state
|
|
468
|
+
* @updated 4.0.0 - Returns IdentityUserDto[] instead of Identity.UserItem[]
|
|
326
469
|
*/
|
|
327
470
|
getUsers() {
|
|
328
471
|
return this.users;
|
|
@@ -338,12 +481,12 @@ var IdentityStateService = class {
|
|
|
338
481
|
// ========================
|
|
339
482
|
/**
|
|
340
483
|
* Fetch roles and update internal state
|
|
341
|
-
* @param params - Optional
|
|
484
|
+
* @param params - Optional pagination/sorting parameters
|
|
342
485
|
*/
|
|
343
486
|
async dispatchGetRoles(params) {
|
|
344
|
-
const response = await this.
|
|
345
|
-
this.roles = response.items;
|
|
346
|
-
this.rolesTotalCount = response.totalCount;
|
|
487
|
+
const response = await this.identityRoleService.getList(params || {});
|
|
488
|
+
this.roles = response.items ?? [];
|
|
489
|
+
this.rolesTotalCount = response.totalCount ?? 0;
|
|
347
490
|
return response;
|
|
348
491
|
}
|
|
349
492
|
/**
|
|
@@ -351,23 +494,22 @@ var IdentityStateService = class {
|
|
|
351
494
|
* @param id - The role ID
|
|
352
495
|
*/
|
|
353
496
|
async dispatchGetRoleById(id) {
|
|
354
|
-
return this.
|
|
497
|
+
return this.identityRoleService.get(id);
|
|
355
498
|
}
|
|
356
499
|
/**
|
|
357
500
|
* Delete a role and refresh the list
|
|
358
501
|
* @param id - The role ID to delete
|
|
359
502
|
*/
|
|
360
503
|
async dispatchDeleteRole(id) {
|
|
361
|
-
|
|
504
|
+
await this.identityRoleService.delete(id);
|
|
362
505
|
await this.dispatchGetRoles();
|
|
363
|
-
return result;
|
|
364
506
|
}
|
|
365
507
|
/**
|
|
366
508
|
* Create a new role and refresh the list
|
|
367
509
|
* @param body - The role data to create
|
|
368
510
|
*/
|
|
369
511
|
async dispatchCreateRole(body) {
|
|
370
|
-
const result = await this.
|
|
512
|
+
const result = await this.identityRoleService.create(body);
|
|
371
513
|
await this.dispatchGetRoles();
|
|
372
514
|
return result;
|
|
373
515
|
}
|
|
@@ -376,7 +518,7 @@ var IdentityStateService = class {
|
|
|
376
518
|
* @param payload - Object containing id and updated role data
|
|
377
519
|
*/
|
|
378
520
|
async dispatchUpdateRole(payload) {
|
|
379
|
-
const result = await this.
|
|
521
|
+
const result = await this.identityRoleService.update(payload.id, payload.body);
|
|
380
522
|
await this.dispatchGetRoles();
|
|
381
523
|
return result;
|
|
382
524
|
}
|
|
@@ -388,9 +530,9 @@ var IdentityStateService = class {
|
|
|
388
530
|
* @param params - Optional query parameters for pagination/filtering
|
|
389
531
|
*/
|
|
390
532
|
async dispatchGetUsers(params) {
|
|
391
|
-
const response = await this.
|
|
392
|
-
this.users = response.items;
|
|
393
|
-
this.usersTotalCount = response.totalCount;
|
|
533
|
+
const response = await this.identityUserService.getList(params || {});
|
|
534
|
+
this.users = response.items ?? [];
|
|
535
|
+
this.usersTotalCount = response.totalCount ?? 0;
|
|
394
536
|
return response;
|
|
395
537
|
}
|
|
396
538
|
/**
|
|
@@ -398,14 +540,14 @@ var IdentityStateService = class {
|
|
|
398
540
|
* @param id - The user ID
|
|
399
541
|
*/
|
|
400
542
|
async dispatchGetUserById(id) {
|
|
401
|
-
return this.
|
|
543
|
+
return this.identityUserService.get(id);
|
|
402
544
|
}
|
|
403
545
|
/**
|
|
404
546
|
* Delete a user and refresh the list
|
|
405
547
|
* @param id - The user ID to delete
|
|
406
548
|
*/
|
|
407
549
|
async dispatchDeleteUser(id) {
|
|
408
|
-
await this.
|
|
550
|
+
await this.identityUserService.delete(id);
|
|
409
551
|
await this.dispatchGetUsers();
|
|
410
552
|
}
|
|
411
553
|
/**
|
|
@@ -413,7 +555,7 @@ var IdentityStateService = class {
|
|
|
413
555
|
* @param body - The user data to create
|
|
414
556
|
*/
|
|
415
557
|
async dispatchCreateUser(body) {
|
|
416
|
-
const result = await this.
|
|
558
|
+
const result = await this.identityUserService.create(body);
|
|
417
559
|
await this.dispatchGetUsers();
|
|
418
560
|
return result;
|
|
419
561
|
}
|
|
@@ -422,7 +564,7 @@ var IdentityStateService = class {
|
|
|
422
564
|
* @param payload - Object containing id and updated user data
|
|
423
565
|
*/
|
|
424
566
|
async dispatchUpdateUser(payload) {
|
|
425
|
-
const result = await this.
|
|
567
|
+
const result = await this.identityUserService.update(payload.id, payload.body);
|
|
426
568
|
await this.dispatchGetUsers();
|
|
427
569
|
return result;
|
|
428
570
|
}
|
|
@@ -431,7 +573,7 @@ var IdentityStateService = class {
|
|
|
431
573
|
* @param id - The user ID
|
|
432
574
|
*/
|
|
433
575
|
async dispatchGetUserRoles(id) {
|
|
434
|
-
return this.
|
|
576
|
+
return this.identityUserService.getRoles(id);
|
|
435
577
|
}
|
|
436
578
|
};
|
|
437
579
|
|
|
@@ -440,7 +582,7 @@ var import_react = require("react");
|
|
|
440
582
|
var import_core2 = require("@abpjs/core");
|
|
441
583
|
function useRoles() {
|
|
442
584
|
const restService = (0, import_core2.useRestService)();
|
|
443
|
-
const service = (0, import_react.useMemo)(() => new
|
|
585
|
+
const service = (0, import_react.useMemo)(() => new IdentityRoleService(restService), [restService]);
|
|
444
586
|
const [roles, setRoles] = (0, import_react.useState)([]);
|
|
445
587
|
const [totalCount, setTotalCount] = (0, import_react.useState)(0);
|
|
446
588
|
const [selectedRole, setSelectedRole] = (0, import_react.useState)(null);
|
|
@@ -452,7 +594,7 @@ function useRoles() {
|
|
|
452
594
|
setIsLoading(true);
|
|
453
595
|
setError(null);
|
|
454
596
|
try {
|
|
455
|
-
const response = await service.
|
|
597
|
+
const response = await service.getList(params || {});
|
|
456
598
|
setRoles(response.items || []);
|
|
457
599
|
setTotalCount(response.totalCount || 0);
|
|
458
600
|
setIsLoading(false);
|
|
@@ -469,7 +611,7 @@ function useRoles() {
|
|
|
469
611
|
setIsLoading(true);
|
|
470
612
|
setError(null);
|
|
471
613
|
try {
|
|
472
|
-
const role = await service.
|
|
614
|
+
const role = await service.get(id);
|
|
473
615
|
setSelectedRole(role);
|
|
474
616
|
setIsLoading(false);
|
|
475
617
|
return { success: true };
|
|
@@ -487,7 +629,7 @@ function useRoles() {
|
|
|
487
629
|
setIsLoading(true);
|
|
488
630
|
setError(null);
|
|
489
631
|
try {
|
|
490
|
-
await service.
|
|
632
|
+
await service.create(role);
|
|
491
633
|
await fetchRoles();
|
|
492
634
|
return { success: true };
|
|
493
635
|
} catch (err) {
|
|
@@ -504,7 +646,7 @@ function useRoles() {
|
|
|
504
646
|
setIsLoading(true);
|
|
505
647
|
setError(null);
|
|
506
648
|
try {
|
|
507
|
-
await service.
|
|
649
|
+
await service.update(id, role);
|
|
508
650
|
await fetchRoles();
|
|
509
651
|
return { success: true };
|
|
510
652
|
} catch (err) {
|
|
@@ -521,7 +663,7 @@ function useRoles() {
|
|
|
521
663
|
setIsLoading(true);
|
|
522
664
|
setError(null);
|
|
523
665
|
try {
|
|
524
|
-
await service.
|
|
666
|
+
await service.delete(id);
|
|
525
667
|
await fetchRoles();
|
|
526
668
|
return { success: true };
|
|
527
669
|
} catch (err) {
|
|
@@ -564,13 +706,14 @@ function useRoles() {
|
|
|
564
706
|
var import_react2 = require("react");
|
|
565
707
|
var import_core3 = require("@abpjs/core");
|
|
566
708
|
var DEFAULT_PAGE_QUERY = {
|
|
709
|
+
filter: "",
|
|
567
710
|
sorting: "userName",
|
|
568
711
|
skipCount: 0,
|
|
569
712
|
maxResultCount: 10
|
|
570
713
|
};
|
|
571
714
|
function useUsers() {
|
|
572
715
|
const restService = (0, import_core3.useRestService)();
|
|
573
|
-
const service = (0, import_react2.useMemo)(() => new
|
|
716
|
+
const service = (0, import_react2.useMemo)(() => new IdentityUserService(restService), [restService]);
|
|
574
717
|
const [users, setUsers] = (0, import_react2.useState)([]);
|
|
575
718
|
const [totalCount, setTotalCount] = (0, import_react2.useState)(0);
|
|
576
719
|
const [selectedUser, setSelectedUser] = (0, import_react2.useState)(null);
|
|
@@ -586,7 +729,7 @@ function useUsers() {
|
|
|
586
729
|
setError(null);
|
|
587
730
|
const queryParams = params || pageQuery;
|
|
588
731
|
try {
|
|
589
|
-
const response = await service.
|
|
732
|
+
const response = await service.getList(queryParams);
|
|
590
733
|
setUsers(response.items || []);
|
|
591
734
|
setTotalCount(response.totalCount || 0);
|
|
592
735
|
setIsLoading(false);
|
|
@@ -605,7 +748,7 @@ function useUsers() {
|
|
|
605
748
|
setIsLoading(true);
|
|
606
749
|
setError(null);
|
|
607
750
|
try {
|
|
608
|
-
const user = await service.
|
|
751
|
+
const user = await service.get(id);
|
|
609
752
|
setSelectedUser(user);
|
|
610
753
|
setIsLoading(false);
|
|
611
754
|
return { success: true };
|
|
@@ -623,7 +766,7 @@ function useUsers() {
|
|
|
623
766
|
setIsLoading(true);
|
|
624
767
|
setError(null);
|
|
625
768
|
try {
|
|
626
|
-
const response = await service.
|
|
769
|
+
const response = await service.getRoles(id);
|
|
627
770
|
setSelectedUserRoles(response.items || []);
|
|
628
771
|
setIsLoading(false);
|
|
629
772
|
return { success: true };
|
|
@@ -641,7 +784,7 @@ function useUsers() {
|
|
|
641
784
|
setIsLoading(true);
|
|
642
785
|
setError(null);
|
|
643
786
|
try {
|
|
644
|
-
await service.
|
|
787
|
+
await service.create(user);
|
|
645
788
|
await fetchUsers();
|
|
646
789
|
return { success: true };
|
|
647
790
|
} catch (err) {
|
|
@@ -658,7 +801,7 @@ function useUsers() {
|
|
|
658
801
|
setIsLoading(true);
|
|
659
802
|
setError(null);
|
|
660
803
|
try {
|
|
661
|
-
await service.
|
|
804
|
+
await service.update(id, user);
|
|
662
805
|
await fetchUsers();
|
|
663
806
|
return { success: true };
|
|
664
807
|
} catch (err) {
|
|
@@ -675,7 +818,7 @@ function useUsers() {
|
|
|
675
818
|
setIsLoading(true);
|
|
676
819
|
setError(null);
|
|
677
820
|
try {
|
|
678
|
-
await service.
|
|
821
|
+
await service.delete(id);
|
|
679
822
|
await fetchUsers();
|
|
680
823
|
return { success: true };
|
|
681
824
|
} catch (err) {
|
|
@@ -845,11 +988,15 @@ function RolesComponent({
|
|
|
845
988
|
const roleData = {
|
|
846
989
|
name: formState.name.trim(),
|
|
847
990
|
isDefault: formState.isDefault,
|
|
848
|
-
isPublic: formState.isPublic
|
|
991
|
+
isPublic: formState.isPublic,
|
|
992
|
+
extraProperties: {}
|
|
849
993
|
};
|
|
850
994
|
let result;
|
|
851
995
|
if (selectedRole?.id) {
|
|
852
|
-
result = await updateRole(selectedRole.id,
|
|
996
|
+
result = await updateRole(selectedRole.id, {
|
|
997
|
+
...roleData,
|
|
998
|
+
concurrencyStamp: selectedRole.concurrencyStamp
|
|
999
|
+
});
|
|
853
1000
|
if (result.success) {
|
|
854
1001
|
onRoleUpdated?.({ ...selectedRole, ...roleData });
|
|
855
1002
|
}
|
|
@@ -998,7 +1145,6 @@ var DEFAULT_FORM_STATE2 = {
|
|
|
998
1145
|
phoneNumber: "",
|
|
999
1146
|
password: "",
|
|
1000
1147
|
lockoutEnabled: true,
|
|
1001
|
-
twoFactorEnabled: true,
|
|
1002
1148
|
roleNames: []
|
|
1003
1149
|
};
|
|
1004
1150
|
function getPasswordRuleLabel(rule, t) {
|
|
@@ -1063,7 +1209,7 @@ function UsersComponent({
|
|
|
1063
1209
|
(0, import_react6.useEffect)(() => {
|
|
1064
1210
|
const newQuery = {
|
|
1065
1211
|
...pageQuery,
|
|
1066
|
-
filter: debouncedSearchTerm ||
|
|
1212
|
+
filter: debouncedSearchTerm || "",
|
|
1067
1213
|
skipCount: 0
|
|
1068
1214
|
};
|
|
1069
1215
|
setPageQuery(newQuery);
|
|
@@ -1094,7 +1240,6 @@ function UsersComponent({
|
|
|
1094
1240
|
phoneNumber: selectedUser.phoneNumber || "",
|
|
1095
1241
|
password: "",
|
|
1096
1242
|
lockoutEnabled: selectedUser.lockoutEnabled ?? true,
|
|
1097
|
-
twoFactorEnabled: selectedUser.twoFactorEnabled ?? true,
|
|
1098
1243
|
roleNames: selectedRoleNames
|
|
1099
1244
|
});
|
|
1100
1245
|
}
|
|
@@ -1130,12 +1275,15 @@ function UsersComponent({
|
|
|
1130
1275
|
phoneNumber: formState.phoneNumber.trim(),
|
|
1131
1276
|
password: formState.password,
|
|
1132
1277
|
lockoutEnabled: formState.lockoutEnabled,
|
|
1133
|
-
|
|
1134
|
-
|
|
1278
|
+
roleNames: formState.roleNames,
|
|
1279
|
+
extraProperties: {}
|
|
1135
1280
|
};
|
|
1136
1281
|
let result;
|
|
1137
1282
|
if (selectedUser?.id) {
|
|
1138
|
-
result = await updateUser(selectedUser.id,
|
|
1283
|
+
result = await updateUser(selectedUser.id, {
|
|
1284
|
+
...userData,
|
|
1285
|
+
concurrencyStamp: selectedUser.concurrencyStamp
|
|
1286
|
+
});
|
|
1139
1287
|
if (result.success) {
|
|
1140
1288
|
onUserUpdated?.({
|
|
1141
1289
|
...selectedUser,
|
|
@@ -1148,10 +1296,8 @@ function UsersComponent({
|
|
|
1148
1296
|
onUserCreated?.({
|
|
1149
1297
|
...userData,
|
|
1150
1298
|
id: "",
|
|
1151
|
-
tenantId: "",
|
|
1152
1299
|
emailConfirmed: false,
|
|
1153
1300
|
phoneNumberConfirmed: false,
|
|
1154
|
-
isLockedOut: false,
|
|
1155
1301
|
concurrencyStamp: ""
|
|
1156
1302
|
});
|
|
1157
1303
|
}
|
|
@@ -1361,14 +1507,6 @@ function UsersComponent({
|
|
|
1361
1507
|
onChange: (e) => handleInputChange("lockoutEnabled", e.target.checked),
|
|
1362
1508
|
children: t("AbpIdentity::DisplayName:LockoutEnabled")
|
|
1363
1509
|
}
|
|
1364
|
-
),
|
|
1365
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1366
|
-
import_theme_shared2.Checkbox,
|
|
1367
|
-
{
|
|
1368
|
-
checked: formState.twoFactorEnabled,
|
|
1369
|
-
onChange: (e) => handleInputChange("twoFactorEnabled", e.target.checked),
|
|
1370
|
-
children: t("AbpIdentity::DisplayName:TwoFactorEnabled")
|
|
1371
|
-
}
|
|
1372
1510
|
)
|
|
1373
1511
|
] }) }),
|
|
1374
1512
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react7.Tabs.Content, { value: "roles", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react7.VStack, { gap: 2, align: "stretch", pt: 4, children: [
|
|
@@ -1434,8 +1572,11 @@ var IDENTITY_POLICIES = {
|
|
|
1434
1572
|
IDENTITY_POLICIES,
|
|
1435
1573
|
IDENTITY_ROUTE_PATHS,
|
|
1436
1574
|
IDENTITY_ROUTE_PROVIDERS,
|
|
1437
|
-
|
|
1575
|
+
IdentityRoleService,
|
|
1438
1576
|
IdentityStateService,
|
|
1577
|
+
IdentityUserLookupService,
|
|
1578
|
+
IdentityUserService,
|
|
1579
|
+
ProfileService,
|
|
1439
1580
|
RolesComponent,
|
|
1440
1581
|
UsersComponent,
|
|
1441
1582
|
configureRoutes,
|