@yrpri/api 9.0.121 → 9.0.122

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.
@@ -808,6 +808,7 @@ function updateDomainProperties(domain, req) {
808
808
  domain.set('configuration.ga4Tag', (req.body.ga4Tag && req.body.ga4Tag !== "") ? req.body.ga4Tag : null);
809
809
  domain.set('configuration.useLoginOnDomainIfNotLoggedIn', truthValueFromBody(req.body.useLoginOnDomainIfNotLoggedIn));
810
810
  domain.set('configuration.forceElectronicIds', truthValueFromBody(req.body.forceElectronicIds));
811
+ domain.set('configuration.doNotCreateElectronicIdUsersAutomatically', truthValueFromBody(req.body.doNotCreateElectronicIdUsersAutomatically));
811
812
  if (req.body.google_analytics_code && req.body.google_analytics_code !== "") {
812
813
  domain.google_analytics_code = req.body.google_analytics_code;
813
814
  }
package/models/user.cjs CHANGED
@@ -114,7 +114,7 @@ module.exports = (sequelize, DataTypes) => {
114
114
  User.serializeSamlUser = (profile, req, callback) => {
115
115
  log.info("Serialize SAML user", { context: 'serializeSamlUser', profile: profile });
116
116
  if (profile.UserSSN) {
117
- sequelize.models.User.serializeIslandIsSamlUser(profile, callback);
117
+ sequelize.models.User.serializeIslandIsSamlUser(profile, req, callback);
118
118
  }
119
119
  else if (profile["urn:mynj:userCode"] || profile.issuer === 'https://my.state.nj.us/idp/shibboleth') {
120
120
  sequelize.models.User.serializeMyNJSamlUser(profile, req, callback);
@@ -188,6 +188,11 @@ module.exports = (sequelize, DataTypes) => {
188
188
  },
189
189
  (seriesCallback) => {
190
190
  if (!user) {
191
+ if (req.ypDomain.configuration &&
192
+ req.ypDomain.configuration.doNotCreateElectronicIdUsersAutomatically) {
193
+ seriesCallback("customError");
194
+ return;
195
+ }
191
196
  sequelize.models.User.create({
192
197
  ssn: profile["urn:mynj:userCode"],
193
198
  name: profile.FirstName + ' ' + profile.LastName,
@@ -227,7 +232,7 @@ module.exports = (sequelize, DataTypes) => {
227
232
  }
228
233
  });
229
234
  };
230
- User.serializeIslandIsSamlUser = (profile, callback) => {
235
+ User.serializeIslandIsSamlUser = (profile, req, callback) => {
231
236
  log.info("User Serialized In Serialize IslandIs SAML User", { context: 'serializeSamlUser', profile: profile });
232
237
  let user;
233
238
  async.series([
@@ -252,6 +257,11 @@ module.exports = (sequelize, DataTypes) => {
252
257
  },
253
258
  (seriesCallback) => {
254
259
  if (!user) {
260
+ if (req.ypDomain.configuration &&
261
+ req.ypDomain.configuration.doNotCreateElectronicIdUsersAutomatically) {
262
+ seriesCallback("customError");
263
+ return;
264
+ }
255
265
  sequelize.models.User.create({
256
266
  ssn: profile.UserSSN,
257
267
  name: profile.Name,
@@ -309,6 +319,11 @@ module.exports = (sequelize, DataTypes) => {
309
319
  },
310
320
  (seriesCallback) => {
311
321
  if (!user) {
322
+ if (req.ypDomain.configuration &&
323
+ req.ypDomain.configuration.doNotCreateElectronicIdUsersAutomatically) {
324
+ seriesCallback("customError");
325
+ return;
326
+ }
312
327
  sequelize.models.User.create({
313
328
  ssn: profile.nationalRegisterId,
314
329
  name: profile.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yrpri/api",
3
- "version": "9.0.121",
3
+ "version": "9.0.122",
4
4
  "license": "MIT",
5
5
  "author": "Robert Bjarnason & Citizens Foundation",
6
6
  "repository": {