@solidstarters/solid-core 1.2.66 → 1.2.67
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/providers/list-of-values-selection-providers.service.d.ts.map +1 -1
- package/dist/providers/list-of-values-selection-providers.service.js +15 -5
- package/dist/providers/list-of-values-selection-providers.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +9 -51
- package/dist/services/authentication.service.d.ts +3 -1
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +12 -3
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/model-metadata.service.d.ts.map +1 -1
- package/dist/services/model-metadata.service.js +11 -9
- package/dist/services/model-metadata.service.js.map +1 -1
- package/dist/services/user.service.d.ts +1 -1
- package/dist/services/user.service.d.ts.map +1 -1
- package/dist/services/user.service.js +2 -2
- package/dist/services/user.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/providers/list-of-values-selection-providers.service.ts +14 -5
- package/src/seeders/seed-data/solid-core-metadata.json +12 -56
- package/src/services/authentication.service.ts +16 -4
- package/src/services/model-metadata.service.ts +15 -12
- package/src/services/user.service.ts +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidstarters/solid-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.67",
|
|
4
4
|
"description": "This module is a NestJS module containing all the required core providers required by a Solid application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,12 +34,21 @@ export class ListOfValuesSelectionProvider implements ISelectionProvider<ListOfV
|
|
|
34
34
|
|
|
35
35
|
async values(query: string, ctxt: ListOfValuesProviderContext): Promise<readonly ISelectionProviderValues[]> {
|
|
36
36
|
const basicFilterQuery = new BasicFilterDto(DEFAULT_LIMIT, 0);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
if (ctxt.type) {
|
|
38
|
+
basicFilterQuery.filters = {
|
|
39
|
+
type: {
|
|
40
|
+
$eq: ctxt.type
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (query) {
|
|
45
|
+
basicFilterQuery.filters = {
|
|
46
|
+
...basicFilterQuery.filters,
|
|
47
|
+
display: {
|
|
48
|
+
$containsi: `%${query}%`
|
|
49
|
+
}
|
|
50
|
+
};
|
|
41
51
|
}
|
|
42
|
-
|
|
43
52
|
const lovs = await this.listOfValuesService.find(basicFilterQuery);
|
|
44
53
|
const selectionValues = lovs.records.map(lov => {
|
|
45
54
|
return {
|
|
@@ -3807,7 +3807,7 @@
|
|
|
3807
3807
|
"name": "media-menu-item",
|
|
3808
3808
|
"sequenceNumber": 3,
|
|
3809
3809
|
"actionUserKey": "media-root",
|
|
3810
|
-
"moduleUserKey": "solid-core",
|
|
3810
|
+
"moduleUserKey": "solid-core",
|
|
3811
3811
|
"parentMenuItemUserKey": ""
|
|
3812
3812
|
},
|
|
3813
3813
|
{
|
|
@@ -3980,32 +3980,11 @@
|
|
|
3980
3980
|
{
|
|
3981
3981
|
"attrs": {
|
|
3982
3982
|
"className": "pi pi-cog",
|
|
3983
|
-
"label": "Generate Code"
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
"
|
|
3987
|
-
"
|
|
3988
|
-
"confirmBtnLabel": "Generate Code",
|
|
3989
|
-
"cancelBtnLabel": "Cancel",
|
|
3990
|
-
"customComponent": "GenerateModuleCodeRowAction",
|
|
3991
|
-
"customComponentIsSystem": true,
|
|
3992
|
-
"endpoint": ""
|
|
3993
|
-
}
|
|
3994
|
-
}
|
|
3995
|
-
],
|
|
3996
|
-
"headerButtons": [
|
|
3997
|
-
{
|
|
3998
|
-
"attrs": {
|
|
3999
|
-
"className": "pi pi-cog",
|
|
4000
|
-
"label": "Generate Code"
|
|
4001
|
-
},
|
|
4002
|
-
"action": {
|
|
4003
|
-
"title": "",
|
|
4004
|
-
"body": "",
|
|
4005
|
-
"confirmBtnLabel": "Generate Code",
|
|
4006
|
-
"cancelBtnLabel": "Cancel",
|
|
4007
|
-
"customComponent": "GenerateModuleCode",
|
|
4008
|
-
"endpoint": ""
|
|
3983
|
+
"label": "Generate Code",
|
|
3984
|
+
"action": "GenerateModuleCodeRowAction",
|
|
3985
|
+
"openInPopup": true,
|
|
3986
|
+
"actionInContextMenu": true,
|
|
3987
|
+
"customComponentIsSystem": true
|
|
4009
3988
|
}
|
|
4010
3989
|
}
|
|
4011
3990
|
]
|
|
@@ -4172,32 +4151,11 @@
|
|
|
4172
4151
|
{
|
|
4173
4152
|
"attrs": {
|
|
4174
4153
|
"className": "pi pi-cog",
|
|
4175
|
-
"label": "Generate Code"
|
|
4176
|
-
|
|
4177
|
-
"action": {
|
|
4178
|
-
"title": "",
|
|
4179
|
-
"body": "",
|
|
4180
|
-
"confirmBtnLabel": "Generate Code",
|
|
4181
|
-
"cancelBtnLabel": "Cancel",
|
|
4182
|
-
"customComponent": "GenerateModelCodeRowAction",
|
|
4154
|
+
"label": "Generate Code",
|
|
4155
|
+
"action": "GenerateModelCodeRowAction",
|
|
4183
4156
|
"customComponentIsSystem": true,
|
|
4184
|
-
"
|
|
4185
|
-
|
|
4186
|
-
}
|
|
4187
|
-
],
|
|
4188
|
-
"headerButtons": [
|
|
4189
|
-
{
|
|
4190
|
-
"attrs": {
|
|
4191
|
-
"className": "pi pi-cog",
|
|
4192
|
-
"label": "Generate Code"
|
|
4193
|
-
},
|
|
4194
|
-
"action": {
|
|
4195
|
-
"title": "",
|
|
4196
|
-
"body": "",
|
|
4197
|
-
"confirmBtnLabel": "Generate Code",
|
|
4198
|
-
"cancelBtnLabel": "Cancel",
|
|
4199
|
-
"customComponent": "GenerateModelCode",
|
|
4200
|
-
"endpoint": ""
|
|
4157
|
+
"actionInContextMenu": true,
|
|
4158
|
+
"openInPopup": true
|
|
4201
4159
|
}
|
|
4202
4160
|
}
|
|
4203
4161
|
]
|
|
@@ -6046,7 +6004,7 @@
|
|
|
6046
6004
|
"attrs": {
|
|
6047
6005
|
"name": "name",
|
|
6048
6006
|
"isSearchable": true
|
|
6049
|
-
|
|
6007
|
+
}
|
|
6050
6008
|
},
|
|
6051
6009
|
{
|
|
6052
6010
|
"type": "field",
|
|
@@ -6210,7 +6168,6 @@
|
|
|
6210
6168
|
]
|
|
6211
6169
|
}
|
|
6212
6170
|
},
|
|
6213
|
-
|
|
6214
6171
|
{
|
|
6215
6172
|
"name": "media-list-view",
|
|
6216
6173
|
"displayName": "Solid Media Model",
|
|
@@ -8673,6 +8630,5 @@
|
|
|
8673
8630
|
}
|
|
8674
8631
|
],
|
|
8675
8632
|
"checksums": [],
|
|
8676
|
-
"listOfValues": [
|
|
8677
|
-
]
|
|
8633
|
+
"listOfValues": []
|
|
8678
8634
|
}
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
} from "../constants";
|
|
42
42
|
import { SettingService } from './setting.service';
|
|
43
43
|
import { CreateUserDto } from 'src/dtos/create-user.dto';
|
|
44
|
+
import { RoleMetadataService } from './role-metadata.service';
|
|
44
45
|
|
|
45
46
|
enum LoginProvider {
|
|
46
47
|
LOCAL = 'local',
|
|
@@ -73,6 +74,8 @@ export class AuthenticationService {
|
|
|
73
74
|
private readonly smsService: Msg91OTPService,
|
|
74
75
|
private readonly eventEmitter: EventEmitter2,
|
|
75
76
|
private readonly settingService: SettingService,
|
|
77
|
+
private readonly roleMetadataService: RoleMetadataService
|
|
78
|
+
|
|
76
79
|
) { }
|
|
77
80
|
|
|
78
81
|
async resolveUser(username: string, email: string) {
|
|
@@ -145,7 +148,7 @@ export class AuthenticationService {
|
|
|
145
148
|
var { user, pwd, autoGeneratedPwd } = await this.populateForSignup<T>(extensionUser, signUpDto);
|
|
146
149
|
const savedUser = await extensionUserRepo.save(user);
|
|
147
150
|
|
|
148
|
-
await this.handlePostSignup(savedUser, signUpDto.roles,
|
|
151
|
+
await this.handlePostSignup(savedUser, signUpDto.roles, pwd, autoGeneratedPwd);
|
|
149
152
|
|
|
150
153
|
return savedUser;
|
|
151
154
|
}
|
|
@@ -158,15 +161,23 @@ export class AuthenticationService {
|
|
|
158
161
|
}
|
|
159
162
|
}
|
|
160
163
|
|
|
161
|
-
|
|
164
|
+
|
|
162
165
|
private async populateForSignup<T extends User>(user: T, signUpDto: SignUpDto, isUserActive: boolean = true) {
|
|
163
166
|
// const user = new User();
|
|
167
|
+
|
|
168
|
+
if (signUpDto.roles && signUpDto.roles.length > 0) {
|
|
169
|
+
for (let i = 0; i < signUpDto.roles.length; i++) {
|
|
170
|
+
const roleName = signUpDto.roles[i];
|
|
171
|
+
await this.roleMetadataService.findRoleByName(roleName);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
164
174
|
user.username = signUpDto.username;
|
|
165
175
|
user.email = signUpDto.email;
|
|
166
176
|
user.fullName = signUpDto.fullName;
|
|
167
177
|
if (signUpDto.mobile) {
|
|
168
178
|
user.mobile = signUpDto.mobile;
|
|
169
179
|
}
|
|
180
|
+
|
|
170
181
|
// If password has been specified by the user, then we simply create & activate the user based on the configuration parameter "activateUserOnRegistration".
|
|
171
182
|
let pwd = '';
|
|
172
183
|
let autoGeneratedPwd = '';
|
|
@@ -186,8 +197,9 @@ export class AuthenticationService {
|
|
|
186
197
|
return { user, pwd, autoGeneratedPwd };
|
|
187
198
|
}
|
|
188
199
|
|
|
189
|
-
|
|
190
|
-
|
|
200
|
+
|
|
201
|
+
private async handlePostSignup(user: User, roles: string[] = [], pwd: string, autoGeneratedPwd: string) {
|
|
202
|
+
await this.userService.initializeRolesForNewUser(roles, user);
|
|
191
203
|
// Tanay: Adding user password to history table
|
|
192
204
|
const userPasswordHistory = new UserPasswordHistory();
|
|
193
205
|
userPasswordHistory.passwordHash = pwd;
|
|
@@ -184,16 +184,19 @@ export class ModelMetadataService {
|
|
|
184
184
|
relations: {},
|
|
185
185
|
});
|
|
186
186
|
createDto['module'] = resolvedModule;
|
|
187
|
+
|
|
188
|
+
if (createDto['parentModelId']) {
|
|
189
|
+
const resolvedParentModel = await this.dataSource
|
|
190
|
+
.getRepository(ModelMetadata)
|
|
191
|
+
.findOne({
|
|
192
|
+
where: {
|
|
193
|
+
id: createDto['parentModelId'],
|
|
194
|
+
},
|
|
195
|
+
relations: {},
|
|
196
|
+
});
|
|
197
|
+
createDto['parentModel'] = resolvedParentModel;
|
|
198
|
+
}
|
|
187
199
|
|
|
188
|
-
const resolvedParentModel = await this.dataSource
|
|
189
|
-
.getRepository(ModelMetadata)
|
|
190
|
-
.findOne({
|
|
191
|
-
where: {
|
|
192
|
-
id: createDto['parentModelId'],
|
|
193
|
-
},
|
|
194
|
-
relations: {},
|
|
195
|
-
});
|
|
196
|
-
createDto['parentModel'] = resolvedParentModel;
|
|
197
200
|
const { fields: fieldsMetadata, ...modelMetaDataWithoutFields } = createDto;
|
|
198
201
|
const modelMetadata = this.modelMetadataRepo.create(modelMetaDataWithoutFields);
|
|
199
202
|
let model = await manager.save(modelMetadata);
|
|
@@ -515,8 +518,8 @@ export class ModelMetadataService {
|
|
|
515
518
|
|
|
516
519
|
// Generate the code for models which are linked to fields having an inverse relation
|
|
517
520
|
const coModelSingularNames = model.fields.
|
|
518
|
-
|
|
519
|
-
|
|
521
|
+
filter(field => field.type === SolidFieldType.relation && field.relationCreateInverse === true)
|
|
522
|
+
.map(field => field.relationCoModelSingularName);
|
|
520
523
|
|
|
521
524
|
for (const singularName of coModelSingularNames) {
|
|
522
525
|
const coModel = await this.findOneBySingularName(singularName);
|
|
@@ -525,7 +528,7 @@ export class ModelMetadataService {
|
|
|
525
528
|
dryRun: options.dryRun
|
|
526
529
|
};
|
|
527
530
|
await this.generateCode(inverseOptions);
|
|
528
|
-
}
|
|
531
|
+
}
|
|
529
532
|
|
|
530
533
|
await this.generateVAMConfig(model.id);
|
|
531
534
|
|
|
@@ -34,7 +34,7 @@ export class UserService extends CRUDService<User> {
|
|
|
34
34
|
readonly moduleRef: ModuleRef,
|
|
35
35
|
@Inject(iamConfig.KEY)
|
|
36
36
|
private readonly iamConfiguration: ConfigType<typeof iamConfig>,
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
) {
|
|
39
39
|
super(modelMetadataService, moduleMetadataService, configService, fileService, discoveryService, crudHelperService, entityManager, repo, 'user', 'solid-core', moduleRef);
|
|
40
40
|
}
|
|
@@ -237,20 +237,20 @@ export class UserService extends CRUDService<User> {
|
|
|
237
237
|
return matchingPermssions
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
initializeRolesForNewUser(roles: string[], user: User) {
|
|
240
|
+
async initializeRolesForNewUser(roles: string[], user: User) {
|
|
241
241
|
if (!user.id) {
|
|
242
|
-
|
|
242
|
+
throw new BadRequestException('User must exist before initializing roles');
|
|
243
243
|
}
|
|
244
244
|
let userRoles = [];
|
|
245
245
|
// Default Internal user role assigned
|
|
246
246
|
userRoles.push("Internal User");
|
|
247
247
|
if (roles) {
|
|
248
|
-
|
|
248
|
+
userRoles = [...userRoles, ...roles];
|
|
249
249
|
}
|
|
250
250
|
userRoles = Array.from(new Set([...userRoles]));
|
|
251
251
|
if (userRoles.length > 0) {
|
|
252
|
-
|
|
252
|
+
await this.addRolesToUser(user.username, userRoles);
|
|
253
253
|
}
|
|
254
|
-
|
|
254
|
+
}
|
|
255
255
|
|
|
256
256
|
}
|