@bluedot-innovation/models 8.2.6 → 8.3.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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 8.3.0
2
+ - Add canvasSso feature to account and identityProvider attribute to user
3
+
1
4
  ## 8.2.6
2
5
  - Add retryEnabled to webhook model
3
6
 
@@ -40,6 +40,11 @@
40
40
  "helloSso": {
41
41
  "enabled": true,
42
42
  "identityProvider": "coles-screens"
43
+ },
44
+ "canvasSso": {
45
+ "enabled": true,
46
+ "identityProvider": "test-azure-idp-dev1",
47
+ "domain": "bluedot.io"
43
48
  }
44
49
  },
45
50
  "integrations": {
@@ -16,5 +16,6 @@ module.exports = {
16
16
  projectId: '1dc621a1-7980-410b-839b-4bed63600139'
17
17
  }
18
18
  ],
19
- mfaRequired: true
19
+ mfaRequired: true,
20
+ identityProvider: "test-azure-idp-dev1"
20
21
  }
@@ -53,6 +53,19 @@ describe('User', () => {
53
53
  done()
54
54
  })
55
55
  })
56
+
57
+ it('should set identityProvider to internal if not present', (done) => {
58
+ user = JSON.parse(JSON.stringify(user))
59
+ delete user.identityProvider
60
+
61
+ const User = new UserModel(user)
62
+ assert(User.identityProvider === "internal")
63
+ User.validate((err, res) => {
64
+ assert.notExists(res)
65
+ assert(err === null, 'err equals null')
66
+ done()
67
+ })
68
+ })
56
69
  })
57
70
 
58
71
  describe('Invalid User', () => {
package/models/User.js CHANGED
@@ -42,6 +42,7 @@ let UserSchema = new mongoose.Schema({
42
42
  },
43
43
  superAdmin: Boolean,
44
44
  mfaRequired: {type: Boolean, default: false, required: true},
45
+ identityProvider: {type: String, default: "internal", required: true}
45
46
  },
46
47
  {collection: 'user'})
47
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "8.2.6",
3
+ "version": "8.3.0",
4
4
  "main": "Models.js",
5
5
  "scripts": {
6
6
  "lint": "./node_modules/.bin/eslint -c .eslintrc.js ./models/*.js ./__tests__/**/*.js ./__tests__/**/**/*.js ./schemas/*.js",
@@ -4,6 +4,7 @@ let AccountBasicFeatureSchema = require('./AccountBasicFeature')
4
4
  let AccountScreensSchema = require('./AccountScreens')
5
5
  let AccountCemdPersistenceSchema = require('./AccountCemdPersistence')
6
6
  let HelloSsoSchema = require('./HelloSso')
7
+ const CanvasSsoSchema = require('./CanvasSsoFeature')
7
8
 
8
9
  let AccountFeaturesSchema = new mongoose.Schema({
9
10
  tempo: AccountTempoSchema,
@@ -14,7 +15,8 @@ let AccountFeaturesSchema = new mongoose.Schema({
14
15
  hideStores: AccountBasicFeatureSchema,
15
16
  automaticDestinationCreation: AccountBasicFeatureSchema,
16
17
  nowReadyConfiguration: AccountBasicFeatureSchema,
17
- helloSso: HelloSsoSchema
18
+ helloSso: HelloSsoSchema,
19
+ canvasSso: CanvasSsoSchema
18
20
  }, {
19
21
  _id: false
20
22
  })
@@ -0,0 +1,11 @@
1
+ let mongoose = require('mongoose')
2
+
3
+ let CanvasSsoSchema = new mongoose.Schema({
4
+ enabled: {type: Boolean, default: true},
5
+ identityProvider: {type: String, required: true},
6
+ domain: {type: String, required: true}
7
+ }, {
8
+ _id: false
9
+ })
10
+
11
+ module.exports = CanvasSsoSchema