Add support for Nylas (and other) integration authentication

This commit is contained in:
Tomaž Jerman
2022-12-06 17:07:45 +01:00
committed by Jože Fortun
parent 9bd739cc9c
commit d53fa26044
17 changed files with 593 additions and 42 deletions
@@ -9,6 +9,15 @@
{{ $t('enabled') }}
</b-form-checkbox>
</b-form-group>
<b-form-group label-cols="3">
<b-form-checkbox
v-model="providerUsage"
:value="true"
:unchecked-value="false"
>
{{ $t('apiAccess') }}
</b-form-checkbox>
</b-form-group>
<b-form-group
:label="$t('clientKey')"
label-cols="3"
@@ -59,5 +68,20 @@ export default {
default: () => ({}),
},
},
computed: {
// providerUsage provides a temporary checkbox implementation until something
// more proper is done
//
// When checked (true), we consider it as wanting to use the API
providerUsage: {
get () {
return ((this.value || {}).usage || []).includes('api')
},
set (value) {
this.value.usage = value ? ['api'] : []
},
},
},
}
</script>
@@ -108,6 +108,7 @@ const idpStandard = [
'github',
'facebook',
'linkedin',
'nylas',
]
const idpSecurity = {
@@ -140,7 +141,7 @@ function prepareExternal (external) {
let out = { ...base }
for (let k in base) {
out[k] = extractKey(`providers.${provider}.${k}`, typeof out[k])
out[k] = extractKey(`providers.${provider}.${k}`, Array.isArray(out[k]) ? 'array' : typeof out[k])
}
return out
@@ -185,6 +186,7 @@ function prepareExternal (external) {
secret: '',
key: '',
security: {},
usage: [],
}),
security: extractSec(`providers.${handle}`),
}))
@@ -395,7 +397,7 @@ export default {
`${prefix}.${p.handle}`,
p,
o.standard[i],
['key', 'secret', 'enabled', 'security'],
['key', 'secret', 'enabled', 'security', 'usage'],
)
})