adapt-authoring-roles 1.4.0 → 1.5.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.
@@ -1,4 +1,4 @@
1
- name: Standard.js formatting check
1
+ name: Lint
2
2
  on: push
3
3
  jobs:
4
4
  default:
@@ -9,4 +9,4 @@ jobs:
9
9
  with:
10
10
  node-version: 'lts/*'
11
11
  - run: npm install
12
- - run: npx standard
12
+ - run: npx standard
@@ -8,7 +8,6 @@ class RolesModule extends AbstractApiModule {
8
8
  /** @override */
9
9
  async init () {
10
10
  await super.init()
11
- this.cache.isEnabled = true
12
11
  try {
13
12
  await this.initConfigRoles()
14
13
 
@@ -17,6 +16,7 @@ class RolesModule extends AbstractApiModule {
17
16
  } catch (e) {
18
17
  this.log('error', e)
19
18
  }
19
+ this.cache.isEnabled = true
20
20
  const [authlocal, users] = await this.app.waitForModule('auth-local', 'users')
21
21
  authlocal.registerHook.tap(this.onUpdateRoles.bind(this))
22
22
  users.requestHook.tap(this.onUpdateRoles.bind(this))
@@ -96,10 +96,9 @@ class RolesModule extends AbstractApiModule {
96
96
 
97
97
  /** @override */
98
98
  async setValues () {
99
- /** @ignore */ this.root = 'roles'
99
+ await super.setValues()
100
100
  /** @ignore */ this.schemaName = 'role'
101
101
  /** @ignore */ this.collectionName = 'roles'
102
- this.useDefaultRouteConfig()
103
102
  }
104
103
 
105
104
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adapt-authoring-roles",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Module for managing user roles",
5
5
  "homepage": "https://github.com/adapt-security/adapt-authoring-roles",
6
6
  "license": "GPL-3.0",
@@ -44,7 +44,7 @@
44
44
  ]
45
45
  },
46
46
  "dependencies": {
47
- "adapt-authoring-api": "^2.0.0"
47
+ "adapt-authoring-api": "^3.0.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "adapt-authoring-auth": "^2.0.0",
package/routes.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "root": "roles"
3
+ }
@@ -13,10 +13,8 @@ import assert from 'node:assert/strict'
13
13
  /** Build a minimal RolesModule-like instance with sensible stub defaults */
14
14
  function createInstance (overrides) {
15
15
  const instance = {
16
- root: undefined,
17
16
  schemaName: undefined,
18
17
  collectionName: undefined,
19
- useDefaultRouteConfig: mock.fn(),
20
18
  app: {
21
19
  waitForModule: mock.fn(async () => ({})),
22
20
  errors: {
@@ -46,10 +44,8 @@ function createInstance (overrides) {
46
44
  // ── Method references (copied from source for isolated testing) ─────
47
45
 
48
46
  async function setValues () {
49
- this.root = 'roles'
50
47
  this.schemaName = 'role'
51
48
  this.collectionName = 'roles'
52
- this.useDefaultRouteConfig()
53
49
  }
54
50
 
55
51
  async function getScopesForRole (_id) {
@@ -171,12 +167,6 @@ describe('RolesModule', () => {
171
167
  // ── setValues ──────────────────────────────────────────────────────
172
168
 
173
169
  describe('setValues', () => {
174
- it('should set root to "roles"', async () => {
175
- const inst = createInstance()
176
- await setValues.call(inst)
177
- assert.equal(inst.root, 'roles')
178
- })
179
-
180
170
  it('should set schemaName to "role"', async () => {
181
171
  const inst = createInstance()
182
172
  await setValues.call(inst)
@@ -188,12 +178,6 @@ describe('RolesModule', () => {
188
178
  await setValues.call(inst)
189
179
  assert.equal(inst.collectionName, 'roles')
190
180
  })
191
-
192
- it('should call useDefaultRouteConfig', async () => {
193
- const inst = createInstance()
194
- await setValues.call(inst)
195
- assert.equal(inst.useDefaultRouteConfig.mock.callCount(), 1)
196
- })
197
181
  })
198
182
 
199
183
  // ── getScopesForRole ───────────────────────────────────────────────