adapt-authoring-content 1.2.3 → 1.2.5

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.
Files changed (2) hide show
  1. package/lib/ContentModule.js +14 -21
  2. package/package.json +38 -2
@@ -9,27 +9,19 @@ import apidefs from './apidefs.js'
9
9
  class ContentModule extends AbstractApiModule {
10
10
  /** @override */
11
11
  async setValues () {
12
- const server = await this.app.waitForModule('server')
13
- /** @ignore */ this.root = 'content'
14
- /** @ignore */ this.collectionName = 'content'
15
- /** @ignore */ this.schemaName = 'content'
16
- /** @ignore */ this.router = server.api.createChildRouter('content')
12
+ /** @ignore */ this.root = this.collectionName = this.schemaName = 'content'
17
13
  this.useDefaultRouteConfig()
18
- /** @ignore */ this.routes = [
19
- {
20
- route: '/insertrecusive',
21
- handlers: { post: this.handleInsertRecursive.bind(this) },
22
- permissions: { post: ['write:content'] },
23
- meta: apidefs.insertrecursive
24
- },
25
- {
26
- route: '/clone',
27
- handlers: { post: this.handleClone.bind(this) },
28
- permissions: { post: ['write:content'] },
29
- meta: apidefs.clone
30
- },
31
- ...this.routes
32
- ]
14
+ this.routes.push({
15
+ route: '/insertrecursive',
16
+ handlers: { post: this.handleInsertRecursive.bind(this) },
17
+ permissions: { post: ['write:content'] },
18
+ meta: apidefs.insertrecursive
19
+ }, {
20
+ route: '/clone',
21
+ handlers: { post: this.handleClone.bind(this) },
22
+ permissions: { post: ['write:content'] },
23
+ meta: apidefs.clone
24
+ })
33
25
  }
34
26
 
35
27
  /** @override */
@@ -382,8 +374,9 @@ class ContentModule extends AbstractApiModule {
382
374
  */
383
375
  async handleClone (req, res, next) {
384
376
  try {
385
- await this.checkAccess(req, req.apiData.query)
386
377
  const { _id, _parentId } = req.body
378
+ const source = await this.findOne({ _id: req.body._id })
379
+ await this.checkAccess(req, source)
387
380
 
388
381
  const customData = { ...req.body }
389
382
  delete customData._id
package/package.json CHANGED
@@ -1,12 +1,40 @@
1
1
  {
2
2
  "name": "adapt-authoring-content",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "Module for managing Adapt content",
5
5
  "homepage": "https://github.com/adapt-security/adapt-authoring-content",
6
6
  "license": "GPL-3.0",
7
7
  "type": "module",
8
8
  "main": "index.js",
9
9
  "repository": "github:adapt-security/adapt-authoring-content",
10
+ "dependencies": {
11
+ "adapt-authoring-api": "^1.3.2",
12
+ "adapt-authoring-core": "^1.7.0"
13
+ },
14
+ "peerDependencies": {
15
+ "adapt-authoring-authored": "^1.1.1",
16
+ "adapt-authoring-contentplugin": "^1.0.6",
17
+ "adapt-authoring-jsonschema": "^1.2.0",
18
+ "adapt-authoring-mongodb": "^1.1.3",
19
+ "adapt-authoring-tags": "^1.0.2"
20
+ },
21
+ "peerDependenciesMeta": {
22
+ "adapt-authoring-authored": {
23
+ "optional": true
24
+ },
25
+ "adapt-authoring-contentplugin": {
26
+ "optional": true
27
+ },
28
+ "adapt-authoring-jsonschema": {
29
+ "optional": true
30
+ },
31
+ "adapt-authoring-mongodb": {
32
+ "optional": true
33
+ },
34
+ "adapt-authoring-tags": {
35
+ "optional": true
36
+ }
37
+ },
10
38
  "devDependencies": {
11
39
  "@semantic-release/git": "^10.0.1",
12
40
  "conventional-changelog-eslint": "^6.0.0",
@@ -29,7 +57,15 @@
29
57
  ],
30
58
  "@semantic-release/npm",
31
59
  "@semantic-release/github",
32
- "@semantic-release/git"
60
+ [
61
+ "@semantic-release/git",
62
+ {
63
+ "assets": [
64
+ "package.json"
65
+ ],
66
+ "message": "Chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
67
+ }
68
+ ]
33
69
  ]
34
70
  }
35
71
  }