adapt-authoring-roles 1.3.0 → 1.3.1
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/lib/RolesModule.js +1 -1
- package/package.json +1 -1
- package/tests/RolesModule.spec.js +0 -6
package/lib/RolesModule.js
CHANGED
|
@@ -83,7 +83,7 @@ class RolesModule extends AbstractApiModule {
|
|
|
83
83
|
async initDefaultRoles () {
|
|
84
84
|
const rolesforAll = await this.shortNamesToIds(this.getConfig('defaultRoles'))
|
|
85
85
|
const rolesForAuth = Object.entries(this.getConfig('defaultRolesForAuthTypes')).reduce((m, [k, v]) => {
|
|
86
|
-
return {
|
|
86
|
+
return { ...m, [k]: this.shortNamesToIds(v) }
|
|
87
87
|
}, {})
|
|
88
88
|
const users = await this.app.waitForModule('users')
|
|
89
89
|
users.preInsertHook.tap(data => {
|
package/package.json
CHANGED
|
@@ -914,12 +914,6 @@ describe('RolesModule', () => {
|
|
|
914
914
|
// ── initDefaultRoles ───────────────────────────────────────────────
|
|
915
915
|
|
|
916
916
|
describe('initDefaultRoles', () => {
|
|
917
|
-
// TODO: Bug - initDefaultRoles has a broken reduce in rolesForAuth.
|
|
918
|
-
// The reduce accumulator is {}, but the callback uses m[k] as a
|
|
919
|
-
// property key (where m is the accumulator). In the first iteration
|
|
920
|
-
// m[k] is undefined, so it creates { undefined: Promise }.
|
|
921
|
-
// defaultRolesForAuthTypes never works correctly.
|
|
922
|
-
// Fix: return { ...m, [k]: this.shortNamesToIds(v) }
|
|
923
917
|
it('should tap into users preInsertHook', async () => {
|
|
924
918
|
const tapMock = mock.fn()
|
|
925
919
|
const usersModule = { preInsertHook: { tap: tapMock } }
|