feat: auth + storage config improvements
This commit is contained in:
parent
bb102c3356
commit
4643336e9d
1
.vscode/extensions.json
vendored
1
.vscode/extensions.json
vendored
@ -4,7 +4,6 @@
|
|||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"christian-kohler.path-intellisense",
|
"christian-kohler.path-intellisense",
|
||||||
"mrmlnc.vscode-puglint",
|
"mrmlnc.vscode-puglint",
|
||||||
"robinbentley.sass-indented",
|
|
||||||
"octref.vetur"
|
"octref.vetur"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
.body-2.grey--text.text--darken-1 Select which authentication strategies to enable:
|
.body-2.grey--text.text--darken-1 Select which authentication strategies to enable:
|
||||||
.caption.grey--text.pb-2 Some strategies require additional configuration in their dedicated tab (when selected).
|
.caption.grey--text.pb-2 Some strategies require additional configuration in their dedicated tab (when selected).
|
||||||
v-form
|
v-form
|
||||||
v-checkbox(
|
v-checkbox.my-1(
|
||||||
v-for='strategy in strategies'
|
v-for='strategy in strategies'
|
||||||
v-model='strategy.isEnabled'
|
v-model='strategy.isEnabled'
|
||||||
:key='strategy.key'
|
:key='strategy.key'
|
||||||
@ -27,14 +27,30 @@
|
|||||||
v-form
|
v-form
|
||||||
v-subheader.pl-0 Strategy Configuration
|
v-subheader.pl-0 Strategy Configuration
|
||||||
.body-1.ml-3(v-if='!strategy.config || strategy.config.length < 1') This strategy has no configuration options you can modify.
|
.body-1.ml-3(v-if='!strategy.config || strategy.config.length < 1') This strategy has no configuration options you can modify.
|
||||||
v-text-field(
|
template(v-else, v-for='cfg in strategy.config')
|
||||||
v-else
|
v-select(
|
||||||
v-for='cfg in strategy.config'
|
v-if='cfg.value.type === "string" && cfg.value.enum'
|
||||||
:key='cfg.key'
|
:items='cfg.value.enum'
|
||||||
:label='cfg.key'
|
:key='cfg.key'
|
||||||
v-model='cfg.value'
|
:label='cfg.key | startCase'
|
||||||
prepend-icon='settings_applications'
|
v-model='cfg.value.value'
|
||||||
|
prepend-icon='settings_applications'
|
||||||
)
|
)
|
||||||
|
v-switch(
|
||||||
|
v-else-if='cfg.value.type === "boolean"'
|
||||||
|
:key='cfg.key'
|
||||||
|
:label='cfg.key | startCase'
|
||||||
|
v-model='cfg.value.value'
|
||||||
|
color='primary'
|
||||||
|
prepend-icon='settings_applications'
|
||||||
|
)
|
||||||
|
v-text-field(
|
||||||
|
v-else
|
||||||
|
:key='cfg.key'
|
||||||
|
:label='cfg.key | startCase'
|
||||||
|
v-model='cfg.value.value'
|
||||||
|
prepend-icon='settings_applications'
|
||||||
|
)
|
||||||
v-divider
|
v-divider
|
||||||
v-subheader.pl-0 Registration
|
v-subheader.pl-0 Registration
|
||||||
.pr-3
|
.pr-3
|
||||||
@ -90,6 +106,9 @@ import strategiesQuery from 'gql/admin/auth/auth-query-strategies.gql'
|
|||||||
import strategiesSaveMutation from 'gql/admin/auth/auth-mutation-save-strategies.gql'
|
import strategiesSaveMutation from 'gql/admin/auth/auth-mutation-save-strategies.gql'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
filters: {
|
||||||
|
startCase(val) { return _.startCase(val) }
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
groups: [],
|
groups: [],
|
||||||
@ -122,7 +141,7 @@ export default {
|
|||||||
'selfRegistration',
|
'selfRegistration',
|
||||||
'domainWhitelist',
|
'domainWhitelist',
|
||||||
'autoEnrollGroups'
|
'autoEnrollGroups'
|
||||||
]))
|
])).map(str => ({...str, config: str.config.map(cfg => ({...cfg, value: cfg.value.value}))}))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.$store.commit('showNotification', {
|
this.$store.commit('showNotification', {
|
||||||
@ -137,7 +156,7 @@ export default {
|
|||||||
strategies: {
|
strategies: {
|
||||||
query: strategiesQuery,
|
query: strategiesQuery,
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
update: (data) => _.cloneDeep(data.authentication.strategies),
|
update: (data) => _.cloneDeep(data.authentication.strategies).map(str => ({...str, config: str.config.map(cfg => ({...cfg, value: JSON.parse(cfg.value)}))})),
|
||||||
watchLoading (isLoading) {
|
watchLoading (isLoading) {
|
||||||
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-auth-refresh')
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-auth-refresh')
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
.body-2.grey--text.text--darken-1 Select which storage targets to enable:
|
.body-2.grey--text.text--darken-1 Select which storage targets to enable:
|
||||||
.caption.grey--text.pb-2 Some storage targets require additional configuration in their dedicated tab (when selected).
|
.caption.grey--text.pb-2 Some storage targets require additional configuration in their dedicated tab (when selected).
|
||||||
v-form
|
v-form
|
||||||
v-checkbox(
|
v-checkbox.my-1(
|
||||||
v-for='tgt in targets'
|
v-for='tgt in targets'
|
||||||
v-model='tgt.isEnabled'
|
v-model='tgt.isEnabled'
|
||||||
:key='tgt.key'
|
:key='tgt.key'
|
||||||
@ -27,14 +27,30 @@
|
|||||||
v-form
|
v-form
|
||||||
v-subheader.pl-0 Target Configuration
|
v-subheader.pl-0 Target Configuration
|
||||||
.body-1.ml-3(v-if='!tgt.config || tgt.config.length < 1') This storage target has no configuration options you can modify.
|
.body-1.ml-3(v-if='!tgt.config || tgt.config.length < 1') This storage target has no configuration options you can modify.
|
||||||
v-text-field(
|
template(v-else, v-for='cfg in tgt.config')
|
||||||
v-else
|
v-select(
|
||||||
v-for='cfg in tgt.config'
|
v-if='cfg.value.type === "string" && cfg.value.enum'
|
||||||
:key='cfg.key'
|
:items='cfg.value.enum'
|
||||||
:label='cfg.key'
|
:key='cfg.key'
|
||||||
v-model='cfg.value'
|
:label='cfg.key | startCase'
|
||||||
prepend-icon='settings_applications'
|
v-model='cfg.value.value'
|
||||||
|
prepend-icon='settings_applications'
|
||||||
)
|
)
|
||||||
|
v-switch(
|
||||||
|
v-else-if='cfg.value.type === "boolean"'
|
||||||
|
:key='cfg.key'
|
||||||
|
:label='cfg.key | startCase'
|
||||||
|
v-model='cfg.value.value'
|
||||||
|
color='primary'
|
||||||
|
prepend-icon='settings_applications'
|
||||||
|
)
|
||||||
|
v-text-field(
|
||||||
|
v-else
|
||||||
|
:key='cfg.key'
|
||||||
|
:label='cfg.key | startCase'
|
||||||
|
v-model='cfg.value.value'
|
||||||
|
prepend-icon='settings_applications'
|
||||||
|
)
|
||||||
v-divider
|
v-divider
|
||||||
v-subheader.pl-0 Sync Direction
|
v-subheader.pl-0 Sync Direction
|
||||||
.body-1.ml-3 Choose how content synchronization is handled for this storage target.
|
.body-1.ml-3 Choose how content synchronization is handled for this storage target.
|
||||||
@ -80,6 +96,9 @@ import targetsQuery from 'gql/admin/storage/storage-query-targets.gql'
|
|||||||
import targetsSaveMutation from 'gql/admin/storage/storage-mutation-save-targets.gql'
|
import targetsSaveMutation from 'gql/admin/storage/storage-mutation-save-targets.gql'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
filters: {
|
||||||
|
startCase(val) { return _.startCase(val) }
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
targets: []
|
targets: []
|
||||||
@ -109,7 +128,7 @@ export default {
|
|||||||
'key',
|
'key',
|
||||||
'config',
|
'config',
|
||||||
'mode'
|
'mode'
|
||||||
]))
|
])).map(str => ({...str, config: str.config.map(cfg => ({...cfg, value: cfg.value.value}))}))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.$store.commit('showNotification', {
|
this.$store.commit('showNotification', {
|
||||||
@ -124,7 +143,7 @@ export default {
|
|||||||
targets: {
|
targets: {
|
||||||
query: targetsQuery,
|
query: targetsQuery,
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
update: (data) => _.cloneDeep(data.storage.targets),
|
update: (data) => _.cloneDeep(data.storage.targets).map(str => ({...str, config: str.config.map(cfg => ({...cfg, value: JSON.parse(cfg.value)}))})),
|
||||||
watchLoading (isLoading) {
|
watchLoading (isLoading) {
|
||||||
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-storage-refresh')
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-storage-refresh')
|
||||||
}
|
}
|
||||||
|
@ -17,17 +17,31 @@
|
|||||||
v-toolbar-title
|
v-toolbar-title
|
||||||
.subheading Authentication
|
.subheading Authentication
|
||||||
v-subheader Flush User Sessions
|
v-subheader Flush User Sessions
|
||||||
v-card-text.pt-0
|
v-card-text.pt-0.pl-4
|
||||||
.body-1 This will cause all users to be logged out. You will need to log back in after the operation.
|
.body-1 This will cause all users to be logged out. You will need to log back in after the operation.
|
||||||
v-btn(depressed).ml-0
|
v-btn(depressed).ml-0
|
||||||
v-icon(left, color='grey') build
|
v-icon(left, color='grey') build
|
||||||
span Proceed
|
span Proceed
|
||||||
|
v-divider.my-0
|
||||||
v-subheader Reset Guest User
|
v-subheader Reset Guest User
|
||||||
v-card-text.pt-0
|
v-card-text.pt-0.pl-4
|
||||||
.body-1 This will reset the guest user to its default parameters and permissions.
|
.body-1 This will reset the guest user to its default parameters and permissions.
|
||||||
v-btn(depressed).ml-0
|
v-btn(depressed).ml-0
|
||||||
v-icon(left, color='grey') build
|
v-icon(left, color='grey') build
|
||||||
span Proceed
|
span Proceed
|
||||||
|
v-card.mt-3
|
||||||
|
v-toolbar(:color='$vuetify.dark ? "" : "grey darken-3"', dark, dense, flat)
|
||||||
|
v-toolbar-title
|
||||||
|
.subheading Modules
|
||||||
|
v-subheader Rescan Modules
|
||||||
|
v-card-text.pt-0.pl-4
|
||||||
|
.body-1 Look for new modules on disk. Existing configurations will be merged.
|
||||||
|
v-btn(depressed).ml-0
|
||||||
|
v-icon(left, color='grey') youtube_searched_for
|
||||||
|
span Authentication
|
||||||
|
v-btn(depressed).ml-0
|
||||||
|
v-icon(left, color='grey') youtube_searched_for
|
||||||
|
span Storage
|
||||||
v-flex(xs12, sm6)
|
v-flex(xs12, sm6)
|
||||||
v-card
|
v-card
|
||||||
v-toolbar(:color='$vuetify.dark ? "" : "grey darken-3"', dark, dense, flat)
|
v-toolbar(:color='$vuetify.dark ? "" : "grey darken-3"', dark, dense, flat)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
mutation($targets: [StorageTargetInput]) {
|
mutation($strategies: [AuthenticationStrategyInput]) {
|
||||||
storage {
|
authentication {
|
||||||
updateTargets(targets: $targets) {
|
updateStrategies(strategies: $strategies) {
|
||||||
responseResult {
|
responseResult {
|
||||||
succeeded
|
succeeded
|
||||||
errorCode
|
errorCode
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
mutation($strategies: [AuthenticationStrategyInput]) {
|
mutation($targets: [StorageTargetInput]) {
|
||||||
authentication {
|
storage {
|
||||||
updateStrategies(strategies: $strategies) {
|
updateTargets(targets: $targets) {
|
||||||
responseResult {
|
responseResult {
|
||||||
succeeded
|
succeeded
|
||||||
errorCode
|
errorCode
|
||||||
|
42
package.json
42
package.json
@ -37,7 +37,7 @@
|
|||||||
"node": ">=8.11"
|
"node": ">=8.11"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"apollo-server": "2.0.0-rc.2",
|
"apollo-server": "2.0.0-rc.5",
|
||||||
"apollo-server-express": "2.0.0-rc.2",
|
"apollo-server-express": "2.0.0-rc.2",
|
||||||
"auto-load": "3.0.0",
|
"auto-load": "3.0.0",
|
||||||
"axios": "0.18.0",
|
"axios": "0.18.0",
|
||||||
@ -69,9 +69,9 @@
|
|||||||
"getos": "3.1.0",
|
"getos": "3.1.0",
|
||||||
"graphql": "0.13.2",
|
"graphql": "0.13.2",
|
||||||
"graphql-list-fields": "2.0.2",
|
"graphql-list-fields": "2.0.2",
|
||||||
"graphql-tools": "3.0.2",
|
"graphql-tools": "3.0.4",
|
||||||
"i18next": "11.3.3",
|
"i18next": "11.3.3",
|
||||||
"i18next-express-middleware": "1.1.1",
|
"i18next-express-middleware": "1.2.0",
|
||||||
"i18next-localstorage-cache": "1.1.1",
|
"i18next-localstorage-cache": "1.1.1",
|
||||||
"i18next-node-fs-backend": "1.0.0",
|
"i18next-node-fs-backend": "1.0.0",
|
||||||
"image-size": "0.6.3",
|
"image-size": "0.6.3",
|
||||||
@ -79,7 +79,7 @@
|
|||||||
"js-yaml": "3.12.0",
|
"js-yaml": "3.12.0",
|
||||||
"jsonwebtoken": "8.3.0",
|
"jsonwebtoken": "8.3.0",
|
||||||
"klaw": "2.1.1",
|
"klaw": "2.1.1",
|
||||||
"knex": "0.14.6",
|
"knex": "0.15.0",
|
||||||
"lodash": "4.17.10",
|
"lodash": "4.17.10",
|
||||||
"markdown-it": "8.4.1",
|
"markdown-it": "8.4.1",
|
||||||
"markdown-it-abbr": "1.0.4",
|
"markdown-it-abbr": "1.0.4",
|
||||||
@ -99,9 +99,9 @@
|
|||||||
"mime-types": "2.1.18",
|
"mime-types": "2.1.18",
|
||||||
"moment": "2.22.2",
|
"moment": "2.22.2",
|
||||||
"moment-timezone": "0.5.21",
|
"moment-timezone": "0.5.21",
|
||||||
"mongodb": "3.1.0-beta4",
|
"mongodb": "3.1.0",
|
||||||
"mssql": "4.1.0",
|
"mssql": "4.1.0",
|
||||||
"multer": "1.3.0",
|
"multer": "1.3.1",
|
||||||
"mysql2": "1.5.3",
|
"mysql2": "1.5.3",
|
||||||
"node-2fa": "1.1.2",
|
"node-2fa": "1.1.2",
|
||||||
"oauth2orize": "1.11.0",
|
"oauth2orize": "1.11.0",
|
||||||
@ -134,12 +134,12 @@
|
|||||||
"scim-query-filter-parser": "1.1.0",
|
"scim-query-filter-parser": "1.1.0",
|
||||||
"semver": "5.5.0",
|
"semver": "5.5.0",
|
||||||
"serve-favicon": "2.5.0",
|
"serve-favicon": "2.5.0",
|
||||||
"sqlite3": "4.0.0",
|
"sqlite3": "4.0.1",
|
||||||
"uuid": "3.2.1",
|
"uuid": "3.3.2",
|
||||||
"validator": "10.4.0",
|
"validator": "10.4.0",
|
||||||
"validator-as-promised": "1.0.2",
|
"validator-as-promised": "1.0.2",
|
||||||
"winston": "3.0.0",
|
"winston": "3.0.0",
|
||||||
"yargs": "11.0.0"
|
"yargs": "12.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@panter/vue-i18next": "0.11.0",
|
"@panter/vue-i18next": "0.11.0",
|
||||||
@ -152,11 +152,11 @@
|
|||||||
"apollo-link-error": "1.1.0",
|
"apollo-link-error": "1.1.0",
|
||||||
"apollo-link-http": "1.5.4",
|
"apollo-link-http": "1.5.4",
|
||||||
"apollo-link-persisted-queries": "0.2.1",
|
"apollo-link-persisted-queries": "0.2.1",
|
||||||
"autoprefixer": "8.6.3",
|
"autoprefixer": "8.6.4",
|
||||||
"babel-cli": "6.26.0",
|
"babel-cli": "6.26.0",
|
||||||
"babel-core": "6.26.3",
|
"babel-core": "6.26.3",
|
||||||
"babel-eslint": "8.2.5",
|
"babel-eslint": "8.2.5",
|
||||||
"babel-jest": "23.0.1",
|
"babel-jest": "23.2.0",
|
||||||
"babel-loader": "7.1.4",
|
"babel-loader": "7.1.4",
|
||||||
"babel-plugin-graphql-tag": "1.6.0",
|
"babel-plugin-graphql-tag": "1.6.0",
|
||||||
"babel-plugin-lodash": "3.3.4",
|
"babel-plugin-lodash": "3.3.4",
|
||||||
@ -168,14 +168,14 @@
|
|||||||
"cache-loader": "1.2.2",
|
"cache-loader": "1.2.2",
|
||||||
"chart.js": "2.7.2",
|
"chart.js": "2.7.2",
|
||||||
"clean-webpack-plugin": "0.1.19",
|
"clean-webpack-plugin": "0.1.19",
|
||||||
"copy-webpack-plugin": "4.5.1",
|
"copy-webpack-plugin": "4.5.2",
|
||||||
"css-loader": "0.28.11",
|
"css-loader": "0.28.11",
|
||||||
"cssnano": "4.0.0-rc.2",
|
"cssnano": "4.0.0-rc.2",
|
||||||
"duplicate-package-checker-webpack-plugin": "3.0.0",
|
"duplicate-package-checker-webpack-plugin": "3.0.0",
|
||||||
"eslint": "5.0.0",
|
"eslint": "5.0.1",
|
||||||
"eslint-config-requarks": "1.0.7",
|
"eslint-config-requarks": "1.0.7",
|
||||||
"eslint-config-standard": "11.0.0",
|
"eslint-config-standard": "11.0.0",
|
||||||
"eslint-plugin-import": "2.12.0",
|
"eslint-plugin-import": "2.13.0",
|
||||||
"eslint-plugin-node": "6.0.1",
|
"eslint-plugin-node": "6.0.1",
|
||||||
"eslint-plugin-promise": "3.8.0",
|
"eslint-plugin-promise": "3.8.0",
|
||||||
"eslint-plugin-standard": "3.1.0",
|
"eslint-plugin-standard": "3.1.0",
|
||||||
@ -190,20 +190,20 @@
|
|||||||
"html-webpack-pug-plugin": "0.3.0",
|
"html-webpack-pug-plugin": "0.3.0",
|
||||||
"i18next-xhr-backend": "1.5.1",
|
"i18next-xhr-backend": "1.5.1",
|
||||||
"ignore-loader": "0.1.2",
|
"ignore-loader": "0.1.2",
|
||||||
"jest": "23.1.0",
|
"jest": "23.2.0",
|
||||||
"jest-junit": "5.1.0",
|
"jest-junit": "5.1.0",
|
||||||
"js-cookie": "2.2.0",
|
"js-cookie": "2.2.0",
|
||||||
"lodash-webpack-plugin": "0.11.5",
|
"lodash-webpack-plugin": "0.11.5",
|
||||||
"mini-css-extract-plugin": "0.4.0",
|
"mini-css-extract-plugin": "0.4.1",
|
||||||
"node-sass": "4.9.0",
|
"node-sass": "4.9.0",
|
||||||
"offline-plugin": "5.0.5",
|
"offline-plugin": "5.0.5",
|
||||||
"optimize-css-assets-webpack-plugin": "4.0.2",
|
"optimize-css-assets-webpack-plugin": "4.0.3",
|
||||||
"postcss-cssnext": "3.1.0",
|
"postcss-cssnext": "3.1.0",
|
||||||
"postcss-flexbugs-fixes": "3.3.1",
|
"postcss-flexbugs-fixes": "3.3.1",
|
||||||
"postcss-flexibility": "2.0.0",
|
"postcss-flexibility": "2.0.0",
|
||||||
"postcss-import": "11.1.0",
|
"postcss-import": "11.1.0",
|
||||||
"postcss-loader": "2.1.5",
|
"postcss-loader": "2.1.5",
|
||||||
"postcss-preset-env": "5.1.0",
|
"postcss-preset-env": "5.2.1",
|
||||||
"postcss-selector-parser": "5.0.0-rc.3",
|
"postcss-selector-parser": "5.0.0-rc.3",
|
||||||
"pug-lint": "2.5.0",
|
"pug-lint": "2.5.0",
|
||||||
"pug-loader": "2.4.0",
|
"pug-loader": "2.4.0",
|
||||||
@ -220,7 +220,7 @@
|
|||||||
"stylus-loader": "3.0.2",
|
"stylus-loader": "3.0.2",
|
||||||
"twemoji-awesome": "1.0.6",
|
"twemoji-awesome": "1.0.6",
|
||||||
"url-loader": "1.0.1",
|
"url-loader": "1.0.1",
|
||||||
"vee-validate": "2.1.0-beta.2",
|
"vee-validate": "2.1.0-beta.5",
|
||||||
"velocity-animate": "1.5.1",
|
"velocity-animate": "1.5.1",
|
||||||
"vue": "2.5.16",
|
"vue": "2.5.16",
|
||||||
"vue-apollo": "3.0.0-beta.19",
|
"vue-apollo": "3.0.0-beta.19",
|
||||||
@ -234,10 +234,10 @@
|
|||||||
"vue-router": "3.0.1",
|
"vue-router": "3.0.1",
|
||||||
"vue-simple-breakpoints": "1.0.3",
|
"vue-simple-breakpoints": "1.0.3",
|
||||||
"vue-template-compiler": "2.5.16",
|
"vue-template-compiler": "2.5.16",
|
||||||
"vuetify": "1.0.19",
|
"vuetify": "1.1.1",
|
||||||
"vuex": "3.0.1",
|
"vuex": "3.0.1",
|
||||||
"vuex-persistedstate": "2.5.4",
|
"vuex-persistedstate": "2.5.4",
|
||||||
"webpack": "4.12.0",
|
"webpack": "4.14.0",
|
||||||
"webpack-bundle-analyzer": "2.13.1",
|
"webpack-bundle-analyzer": "2.13.1",
|
||||||
"webpack-cli": "3.0.8",
|
"webpack-cli": "3.0.8",
|
||||||
"webpack-dev-middleware": "3.1.3",
|
"webpack-dev-middleware": "3.1.3",
|
||||||
|
@ -2,6 +2,7 @@ const Model = require('objection').Model
|
|||||||
const autoload = require('auto-load')
|
const autoload = require('auto-load')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
|
const commonHelper = require('../../helpers/common')
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
@ -51,8 +52,22 @@ module.exports = class Authentication extends Model {
|
|||||||
title: strategy.title,
|
title: strategy.title,
|
||||||
isEnabled: false,
|
isEnabled: false,
|
||||||
useForm: strategy.useForm,
|
useForm: strategy.useForm,
|
||||||
config: _.reduce(strategy.props, (result, value, key) => {
|
config: _.transform(strategy.props, (result, value, key) => {
|
||||||
_.set(result, value, '')
|
if (_.isPlainObject(value)) {
|
||||||
|
let cfgValue = {
|
||||||
|
type: typeof value.type(),
|
||||||
|
value: !_.isNil(value.default) ? value.default : commonHelper.getTypeDefaultValue(value)
|
||||||
|
}
|
||||||
|
if (_.isArray(value.enum)) {
|
||||||
|
cfgValue.enum = value.enum
|
||||||
|
}
|
||||||
|
_.set(result, key, cfgValue)
|
||||||
|
} else {
|
||||||
|
_.set(result, key, {
|
||||||
|
type: typeof value(),
|
||||||
|
value: commonHelper.getTypeDefaultValue(value)
|
||||||
|
})
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}, {}),
|
}, {}),
|
||||||
selfRegistration: false,
|
selfRegistration: false,
|
||||||
|
@ -2,6 +2,7 @@ const Model = require('objection').Model
|
|||||||
const autoload = require('auto-load')
|
const autoload = require('auto-load')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
|
const commonHelper = require('../../helpers/common')
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
@ -43,8 +44,22 @@ module.exports = class Storage extends Model {
|
|||||||
title: target.title,
|
title: target.title,
|
||||||
isEnabled: false,
|
isEnabled: false,
|
||||||
mode: 'push',
|
mode: 'push',
|
||||||
config: _.reduce(target.props, (result, value, key) => {
|
config: _.transform(target.props, (result, value, key) => {
|
||||||
_.set(result, value, '')
|
if (_.isPlainObject(value)) {
|
||||||
|
let cfgValue = {
|
||||||
|
type: typeof value.type(),
|
||||||
|
value: !_.isNil(value.default) ? value.default : commonHelper.getTypeDefaultValue(value)
|
||||||
|
}
|
||||||
|
if (_.isArray(value.enum)) {
|
||||||
|
cfgValue.enum = value.enum
|
||||||
|
}
|
||||||
|
_.set(result, key, cfgValue)
|
||||||
|
} else {
|
||||||
|
_.set(result, key, {
|
||||||
|
type: typeof value(),
|
||||||
|
value: commonHelper.getTypeDefaultValue(value)
|
||||||
|
})
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}, {})
|
}, {})
|
||||||
})
|
})
|
||||||
|
@ -19,9 +19,9 @@ module.exports = {
|
|||||||
let strategies = await WIKI.db.authentication.getStrategies()
|
let strategies = await WIKI.db.authentication.getStrategies()
|
||||||
strategies = strategies.map(stg => ({
|
strategies = strategies.map(stg => ({
|
||||||
...stg,
|
...stg,
|
||||||
config: _.transform(stg.config, (res, value, key) => {
|
config: _.sortBy(_.transform(stg.config, (res, value, key) => {
|
||||||
res.push({ key, value })
|
res.push({ key, value: JSON.stringify(value) })
|
||||||
}, [])
|
}, []), 'key')
|
||||||
}))
|
}))
|
||||||
if (args.filter) { strategies = graphHelper.filter(strategies, args.filter) }
|
if (args.filter) { strategies = graphHelper.filter(strategies, args.filter) }
|
||||||
if (args.orderBy) { strategies = graphHelper.orderBy(strategies, args.orderBy) }
|
if (args.orderBy) { strategies = graphHelper.orderBy(strategies, args.orderBy) }
|
||||||
@ -57,7 +57,7 @@ module.exports = {
|
|||||||
await WIKI.db.authentication.query().patch({
|
await WIKI.db.authentication.query().patch({
|
||||||
isEnabled: str.isEnabled,
|
isEnabled: str.isEnabled,
|
||||||
config: _.reduce(str.config, (result, value, key) => {
|
config: _.reduce(str.config, (result, value, key) => {
|
||||||
_.set(result, value.key, value.value)
|
_.set(result, `${value.key}.value`, value.value)
|
||||||
return result
|
return result
|
||||||
}, {}),
|
}, {}),
|
||||||
selfRegistration: str.selfRegistration,
|
selfRegistration: str.selfRegistration,
|
||||||
|
@ -13,11 +13,11 @@ module.exports = {
|
|||||||
StorageQuery: {
|
StorageQuery: {
|
||||||
async targets(obj, args, context, info) {
|
async targets(obj, args, context, info) {
|
||||||
let targets = await WIKI.db.storage.getTargets()
|
let targets = await WIKI.db.storage.getTargets()
|
||||||
targets = targets.map(stg => ({
|
targets = targets.map(tgt => ({
|
||||||
...stg,
|
...tgt,
|
||||||
config: _.transform(stg.config, (res, value, key) => {
|
config: _.sortBy(_.transform(tgt.config, (res, value, key) => {
|
||||||
res.push({ key, value })
|
res.push({ key, value: JSON.stringify(value) })
|
||||||
}, [])
|
}, []), 'key')
|
||||||
}))
|
}))
|
||||||
if (args.filter) { targets = graphHelper.filter(targets, args.filter) }
|
if (args.filter) { targets = graphHelper.filter(targets, args.filter) }
|
||||||
if (args.orderBy) { targets = graphHelper.orderBy(targets, args.orderBy) }
|
if (args.orderBy) { targets = graphHelper.orderBy(targets, args.orderBy) }
|
||||||
@ -32,7 +32,7 @@ module.exports = {
|
|||||||
isEnabled: tgt.isEnabled,
|
isEnabled: tgt.isEnabled,
|
||||||
mode: tgt.mode,
|
mode: tgt.mode,
|
||||||
config: _.reduce(tgt.config, (result, value, key) => {
|
config: _.reduce(tgt.config, (result, value, key) => {
|
||||||
_.set(result, value.key, value.value)
|
_.set(result, `${value.key}.value`, value.value)
|
||||||
return result
|
return result
|
||||||
}, {})
|
}, {})
|
||||||
}).where('key', tgt.key)
|
}).where('key', tgt.key)
|
||||||
|
17
server/helpers/common.js
Normal file
17
server/helpers/common.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const _ = require('lodash')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
/**
|
||||||
|
* Get default value of type
|
||||||
|
*
|
||||||
|
* @param {any} Type Primitive Type
|
||||||
|
* @returns Default value
|
||||||
|
*/
|
||||||
|
getTypeDefaultValue (Type) {
|
||||||
|
if (_.isArray(Type)) {
|
||||||
|
return _.head(Type)
|
||||||
|
} else {
|
||||||
|
return new Type()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,7 +10,11 @@ module.exports = {
|
|||||||
key: 'auth0',
|
key: 'auth0',
|
||||||
title: 'Auth0',
|
title: 'Auth0',
|
||||||
useForm: false,
|
useForm: false,
|
||||||
props: ['domain', 'clientId', 'clientSecret'],
|
props: {
|
||||||
|
domain: String,
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('auth0',
|
passport.use('auth0',
|
||||||
new Auth0Strategy({
|
new Auth0Strategy({
|
||||||
|
@ -10,7 +10,18 @@ module.exports = {
|
|||||||
key: 'azure',
|
key: 'azure',
|
||||||
title: 'Azure Active Directory',
|
title: 'Azure Active Directory',
|
||||||
useForm: false,
|
useForm: false,
|
||||||
props: ['clientId', 'clientSecret', 'resource', 'tenant'],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String,
|
||||||
|
resource: {
|
||||||
|
type: String,
|
||||||
|
default: '00000002-0000-0000-c000-000000000000'
|
||||||
|
},
|
||||||
|
tenant: {
|
||||||
|
type: String,
|
||||||
|
default: 'YOUR_TENANT.onmicrosoft.com'
|
||||||
|
}
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
const jwt = require('jsonwebtoken')
|
const jwt = require('jsonwebtoken')
|
||||||
passport.use('azure_ad_oauth2',
|
passport.use('azure_ad_oauth2',
|
||||||
|
@ -10,7 +10,10 @@ module.exports = {
|
|||||||
key: 'discord',
|
key: 'discord',
|
||||||
title: 'Discord',
|
title: 'Discord',
|
||||||
useForm: false,
|
useForm: false,
|
||||||
props: ['clientId', 'clientSecret'],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('discord',
|
passport.use('discord',
|
||||||
new DiscordStrategy({
|
new DiscordStrategy({
|
||||||
|
@ -10,7 +10,10 @@ module.exports = {
|
|||||||
key: 'dropbox',
|
key: 'dropbox',
|
||||||
title: 'Dropbox',
|
title: 'Dropbox',
|
||||||
useForm: false,
|
useForm: false,
|
||||||
props: ['clientId', 'clientSecret'],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('dropbox',
|
passport.use('dropbox',
|
||||||
new DropboxStrategy({
|
new DropboxStrategy({
|
||||||
|
@ -10,7 +10,10 @@ module.exports = {
|
|||||||
key: 'facebook',
|
key: 'facebook',
|
||||||
title: 'Facebook',
|
title: 'Facebook',
|
||||||
useForm: false,
|
useForm: false,
|
||||||
props: ['clientId', 'clientSecret'],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('facebook',
|
passport.use('facebook',
|
||||||
new FacebookStrategy({
|
new FacebookStrategy({
|
||||||
|
@ -10,7 +10,10 @@ module.exports = {
|
|||||||
key: 'github',
|
key: 'github',
|
||||||
title: 'GitHub',
|
title: 'GitHub',
|
||||||
useForm: false,
|
useForm: false,
|
||||||
props: ['clientId', 'clientSecret'],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('github',
|
passport.use('github',
|
||||||
new GitHubStrategy({
|
new GitHubStrategy({
|
||||||
|
@ -10,7 +10,10 @@ module.exports = {
|
|||||||
key: 'google',
|
key: 'google',
|
||||||
title: 'Google',
|
title: 'Google',
|
||||||
useForm: false,
|
useForm: false,
|
||||||
props: ['clientId', 'clientSecret'],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('google',
|
passport.use('google',
|
||||||
new GoogleStrategy({
|
new GoogleStrategy({
|
||||||
|
@ -11,7 +11,30 @@ module.exports = {
|
|||||||
key: 'ldap',
|
key: 'ldap',
|
||||||
title: 'LDAP / Active Directory',
|
title: 'LDAP / Active Directory',
|
||||||
useForm: true,
|
useForm: true,
|
||||||
props: ['url', 'bindDn', 'bindCredentials', 'searchBase', 'searchFilter', 'tlsEnabled', 'tlsCertPath'],
|
props: {
|
||||||
|
url: {
|
||||||
|
type: String,
|
||||||
|
default: 'ldap://serverhost:389'
|
||||||
|
},
|
||||||
|
bindDn: {
|
||||||
|
type: String,
|
||||||
|
default: `cn='root'`
|
||||||
|
},
|
||||||
|
bindCredentials: String,
|
||||||
|
searchBase: {
|
||||||
|
type: String,
|
||||||
|
default: 'o=users,o=example.com'
|
||||||
|
},
|
||||||
|
searchFilter: {
|
||||||
|
type: String,
|
||||||
|
default: '(uid={{username}})'
|
||||||
|
},
|
||||||
|
tlsEnabled: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
tlsCertPath: String
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('ldapauth',
|
passport.use('ldapauth',
|
||||||
new LdapStrategy({
|
new LdapStrategy({
|
||||||
|
@ -10,7 +10,7 @@ module.exports = {
|
|||||||
key: 'local',
|
key: 'local',
|
||||||
title: 'Local',
|
title: 'Local',
|
||||||
useForm: true,
|
useForm: true,
|
||||||
props: [],
|
props: {},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('local',
|
passport.use('local',
|
||||||
new LocalStrategy({
|
new LocalStrategy({
|
||||||
|
@ -10,7 +10,10 @@ module.exports = {
|
|||||||
key: 'microsoft',
|
key: 'microsoft',
|
||||||
title: 'Microsoft Account',
|
title: 'Microsoft Account',
|
||||||
useForm: false,
|
useForm: false,
|
||||||
props: ['clientId', 'clientSecret'],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('microsoft',
|
passport.use('microsoft',
|
||||||
new WindowsLiveStrategy({
|
new WindowsLiveStrategy({
|
||||||
|
@ -10,7 +10,12 @@ module.exports = {
|
|||||||
key: 'oauth2',
|
key: 'oauth2',
|
||||||
title: 'OAuth2',
|
title: 'OAuth2',
|
||||||
useForm: false,
|
useForm: false,
|
||||||
props: ['clientId', 'clientSecret', 'authorizationURL', 'tokenURL'],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String,
|
||||||
|
authorizationURL: String,
|
||||||
|
tokenURL: String
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('oauth2',
|
passport.use('oauth2',
|
||||||
new OAuth2Strategy({
|
new OAuth2Strategy({
|
||||||
|
@ -10,7 +10,10 @@ module.exports = {
|
|||||||
key: 'slack',
|
key: 'slack',
|
||||||
title: 'Slack',
|
title: 'Slack',
|
||||||
useForm: false,
|
useForm: false,
|
||||||
props: ['clientId', 'clientSecret'],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('slack',
|
passport.use('slack',
|
||||||
new SlackStrategy({
|
new SlackStrategy({
|
||||||
|
@ -10,7 +10,10 @@ module.exports = {
|
|||||||
key: 'twitch',
|
key: 'twitch',
|
||||||
title: 'Twitch',
|
title: 'Twitch',
|
||||||
useForm: false,
|
useForm: false,
|
||||||
props: ['clientId', 'clientSecret'],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String
|
||||||
|
},
|
||||||
init (passport, conf) {
|
init (passport, conf) {
|
||||||
passport.use('twitch',
|
passport.use('twitch',
|
||||||
new TwitchStrategy({
|
new TwitchStrategy({
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
key: 'azure',
|
key: 'azure',
|
||||||
title: 'Azure Blob Storage',
|
title: 'Azure Blob Storage',
|
||||||
props: [],
|
props: {
|
||||||
|
accountName: String,
|
||||||
|
accountKey: String,
|
||||||
|
container: String
|
||||||
|
},
|
||||||
activate() {
|
activate() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
key: 'digitalocean',
|
key: 'digitalocean',
|
||||||
title: 'DigialOcean Spaces',
|
title: 'DigialOcean Spaces',
|
||||||
props: ['accessKeyId', 'accessSecret', 'region', 'bucket'],
|
props: {
|
||||||
|
accessKeyId: String,
|
||||||
|
accessSecret: String,
|
||||||
|
region: {
|
||||||
|
type: String,
|
||||||
|
default: 'nyc3'
|
||||||
|
},
|
||||||
|
bucket: String
|
||||||
|
},
|
||||||
activate() {
|
activate() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
key: 'disk',
|
key: 'disk',
|
||||||
title: 'Local FS',
|
title: 'Local FS',
|
||||||
props: ['path'],
|
props: {
|
||||||
|
path: String
|
||||||
|
},
|
||||||
activate() {
|
activate() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
key: 'dropbox',
|
key: 'dropbox',
|
||||||
title: 'Dropbox',
|
title: 'Dropbox',
|
||||||
props: [],
|
props: {
|
||||||
|
appKey: String,
|
||||||
|
appSecret: String
|
||||||
|
},
|
||||||
activate() {
|
activate() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
key: 'gdrive',
|
key: 'gdrive',
|
||||||
title: 'Google Drive',
|
title: 'Google Drive',
|
||||||
props: [],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String
|
||||||
|
},
|
||||||
activate() {
|
activate() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,25 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
key: 'git',
|
key: 'git',
|
||||||
title: 'Git',
|
title: 'Git',
|
||||||
props: [],
|
props: {
|
||||||
|
authType: {
|
||||||
|
type: String,
|
||||||
|
default: 'ssh',
|
||||||
|
enum: ['basic', 'ssh']
|
||||||
|
},
|
||||||
|
repoUrl: String,
|
||||||
|
branch: {
|
||||||
|
type: String,
|
||||||
|
default: 'master'
|
||||||
|
},
|
||||||
|
verifySSL: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
sshPrivateKeyPath: String,
|
||||||
|
basicUsername: String,
|
||||||
|
basicPassword: String
|
||||||
|
},
|
||||||
activate() {
|
activate() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
key: 'onedrive',
|
key: 'onedrive',
|
||||||
title: 'OneDrive',
|
title: 'OneDrive',
|
||||||
props: [],
|
props: {
|
||||||
|
clientId: String,
|
||||||
|
clientSecret: String
|
||||||
|
},
|
||||||
activate() {
|
activate() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
key: 's3',
|
key: 's3',
|
||||||
title: 'Amazon S3',
|
title: 'Amazon S3',
|
||||||
props: [],
|
props: {
|
||||||
|
accessKeyId: String,
|
||||||
|
accessSecret: String,
|
||||||
|
region: String,
|
||||||
|
bucket: String
|
||||||
|
},
|
||||||
activate() {
|
activate() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,19 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
key: 'scp',
|
key: 'scp',
|
||||||
title: 'SCP (SSH)',
|
title: 'SCP (SSH)',
|
||||||
props: [],
|
props: {
|
||||||
|
host: String,
|
||||||
|
port: {
|
||||||
|
type: Number,
|
||||||
|
default: 22
|
||||||
|
},
|
||||||
|
username: String,
|
||||||
|
privateKeyPath: String,
|
||||||
|
basePath: {
|
||||||
|
type: String,
|
||||||
|
default: '~'
|
||||||
|
}
|
||||||
|
},
|
||||||
activate() {
|
activate() {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user