7c16abc8eb
* feat(workspaces): add workspaces module with roles and scopes * feat(workspaces): add domain, graphql and persistent storage dataschema * fix(workspaces): correct db injections * chore(workspaces): add EE license * chore(license): mentions workspaces separately in license file * fix(core): roles import in migration * fix(workspaces): drop workspace_acl on down migration * fix(workspaces): roles constants * fix(workspaces): coding standards --------- Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
28 lines
829 B
JavaScript
28 lines
829 B
JavaScript
'use strict'
|
|
const { registerOrUpdateScopeFactory } = require('@/modules/shared/repositories/scopes')
|
|
const { moduleLogger } = require('@/logging/logging')
|
|
const db = require('@/db/knex')
|
|
|
|
exports.init = async (app) => {
|
|
moduleLogger.info('🔑 Init auth module')
|
|
|
|
// Initialize authn strategies
|
|
exports.authStrategies = await require('./strategies')(app)
|
|
|
|
// Hoist auth routes
|
|
require('./rest')(app)
|
|
|
|
// Register core-based scopes
|
|
const scopes = require('./scopes.js')
|
|
const registerFunc = registerOrUpdateScopeFactory({ db })
|
|
for (const scope of scopes) {
|
|
await registerFunc({ scope })
|
|
}
|
|
}
|
|
|
|
exports.finalize = async () => {
|
|
// Note: we're registering the default apps last as we want to ensure that all
|
|
// scopes have been registered by any other modules.
|
|
await require('./manageDefaultApps')()
|
|
}
|