@strapi/plugin-users-permissions 4.1.11 → 4.1.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "4.1.11",
3
+ "version": "4.1.12",
4
4
  "description": "Protect your API with a full-authentication process based on JWT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,8 +27,8 @@
27
27
  "test:front:watch:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll"
28
28
  },
29
29
  "dependencies": {
30
- "@strapi/helper-plugin": "4.1.11",
31
- "@strapi/utils": "4.1.11",
30
+ "@strapi/helper-plugin": "4.1.12",
31
+ "@strapi/utils": "4.1.12",
32
32
  "bcryptjs": "2.4.3",
33
33
  "grant-koa": "5.4.8",
34
34
  "jsonwebtoken": "^8.1.0",
@@ -59,5 +59,5 @@
59
59
  "required": true,
60
60
  "kind": "plugin"
61
61
  },
62
- "gitHead": "698ae33e0007811ce24b568cc5d873d7a4d2a832"
62
+ "gitHead": "ab698015cfc4f43fa0ce2ae94ec59e00a67e4cda"
63
63
  }
@@ -378,7 +378,7 @@ module.exports = {
378
378
  throw new ValidationError('token.invalid');
379
379
  }
380
380
 
381
- const [user] = await userService.fetchAll({ filters: { confirmationToken }});
381
+ const [user] = await userService.fetchAll({ filters: { confirmationToken } });
382
382
 
383
383
  if (!user) {
384
384
  throw new ValidationError('token.invalid');
@@ -12,7 +12,7 @@ const { getService } = require('../utils');
12
12
  const { validateCreateUserBody, validateUpdateUserBody } = require('./validation/user');
13
13
 
14
14
  const { sanitize } = utils;
15
- const { ApplicationError, ValidationError } = utils.errors;
15
+ const { ApplicationError, ValidationError, NotFoundError } = utils.errors;
16
16
 
17
17
  const sanitizeOutput = (user, ctx) => {
18
18
  const schema = strapi.getModel('plugin::users-permissions.user');
@@ -91,6 +91,10 @@ module.exports = {
91
91
  const { email, username, password } = ctx.request.body;
92
92
 
93
93
  const user = await getService('user').fetch(id);
94
+ if (!user) {
95
+ throw new NotFoundError(`User not found`);
96
+ }
97
+
94
98
 
95
99
  await validateUpdateUserBody(ctx.request.body);
96
100
 
@@ -19,7 +19,7 @@ module.exports = ({ nexus, strapi }) => {
19
19
  async resolve(parent, args, context) {
20
20
  const { koaContext } = context;
21
21
 
22
- koaContext.request.body = toPlainObject(args);
22
+ koaContext.query = toPlainObject(args);
23
23
 
24
24
  await strapi
25
25
  .plugin('users-permissions')
@@ -19,7 +19,7 @@ module.exports = ({ nexus, strapi }) => {
19
19
  id: nonNull('ID'),
20
20
  },
21
21
 
22
- description: 'Update an existing user',
22
+ description: 'Delete an existing user',
23
23
 
24
24
  async resolve(parent, args, context) {
25
25
  const { koaContext } = context;
@@ -26,12 +26,12 @@ module.exports = ({ strapi }) => {
26
26
 
27
27
  // Scoped auth for replaced CRUD operations
28
28
  // Role
29
- [`Mutation.${createRole}`]: { auth: { scope: [`${roleUID}.create`] } },
30
- [`Mutation.${updateRole}`]: { auth: { scope: [`${roleUID}.update`] } },
31
- [`Mutation.${deleteRole}`]: { auth: { scope: [`${roleUID}.delete`] } },
29
+ [`Mutation.${createRole}`]: { auth: { scope: [`${roleUID}.createRole`] } },
30
+ [`Mutation.${updateRole}`]: { auth: { scope: [`${roleUID}.updateRole`] } },
31
+ [`Mutation.${deleteRole}`]: { auth: { scope: [`${roleUID}.deleteRole`] } },
32
32
  // User
33
33
  [`Mutation.${createUser}`]: { auth: { scope: [`${userUID}.create`] } },
34
34
  [`Mutation.${updateUser}`]: { auth: { scope: [`${userUID}.update`] } },
35
- [`Mutation.${deleteUser}`]: { auth: { scope: [`${userUID}.delete`] } },
35
+ [`Mutation.${deleteUser}`]: { auth: { scope: [`${userUID}.destroy`] } },
36
36
  };
37
37
  };