From e958276698e794e7f65dc953e6af6e49783762ff Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 4 Oct 2019 10:16:41 +0000 Subject: [PATCH 1/2] build(deps): bump feathers-authentication-hooks from 0.3.1 to 1.0.0 Bumps [feathers-authentication-hooks](https://github.com/feathersjs-ecosystem/feathers-authentication-hooks) from 0.3.1 to 1.0.0. - [Release notes](https://github.com/feathersjs-ecosystem/feathers-authentication-hooks/releases) - [Changelog](https://github.com/feathersjs-ecosystem/feathers-authentication-hooks/blob/master/CHANGELOG.md) - [Commits](https://github.com/feathersjs-ecosystem/feathers-authentication-hooks/compare/v0.3.1...v1.0.0) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 27 ++++++++------------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 74bc242e..5ce872a0 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "cls-hooked": "^4.2.2", "compression": "^1.7.4", "cors": "^2.8.5", - "feathers-authentication-hooks": "^0.3.1", + "feathers-authentication-hooks": "^1.0.0", "feathers-hooks-common": "^4.20.7", "feathers-permissions": "^0.2.1", "feathers-sequelize": "^6.0.2", diff --git a/yarn.lock b/yarn.lock index 7d76bf53..a5621e98 100644 --- a/yarn.lock +++ b/yarn.lock @@ -118,7 +118,7 @@ dependencies: debug "^4.1.1" -"@feathersjs/express@^4.3.3", "@feathersjs/express@^4.3.4": +"@feathersjs/express@^4.3.4": version "4.3.4" resolved "https://registry.yarnpkg.com/@feathersjs/express/-/express-4.3.4.tgz#27ce1f9dba15b39a66353d409678ddfcce266b5c" integrity sha512-t30iklJsgXqiOpzDGJ0UjcLHQlJC7YBqOdrx/qyYDS496urlsg4jY5gXU8JZZhnZig2m67cKDL3sbWeSpfhhJA== @@ -162,17 +162,6 @@ socket.io "^2.2.0" uberproto "^2.0.4" -"@feathersjs/transport-commons@^4.3.3", "@feathersjs/transport-commons@^4.3.4": - version "4.3.4" - resolved "https://registry.yarnpkg.com/@feathersjs/transport-commons/-/transport-commons-4.3.4.tgz#fa60262665d54575ef2cd0272c55e0115adbec9f" - integrity sha512-94ijldtdPm0s4ZlOutk2mLGiUj4QWOIaj/g3XFQRIe8GM+MzKLrpY4ldLiHMAEleVOjyo2qH5Ar8qN4QLUcF5g== - dependencies: - "@feathersjs/commons" "^4.3.0" - "@feathersjs/errors" "^4.3.4" - debug "^4.1.1" - lodash "^4.17.15" - radix-router "^3.0.1" - "@feathersjs/transport-commons@^4.3.4": version "4.3.4" resolved "https://registry.yarnpkg.com/@feathersjs/transport-commons/-/transport-commons-4.3.4.tgz#fa60262665d54575ef2cd0272c55e0115adbec9f" @@ -1576,14 +1565,14 @@ fast-safe-stringify@^2.0.4: resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.6.tgz#04b26106cc56681f51a044cfc0d76cf0008ac2c2" integrity sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg== -feathers-authentication-hooks@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/feathers-authentication-hooks/-/feathers-authentication-hooks-0.3.1.tgz#a6c595ef626f5c289492d304ad6364ae547dae76" - integrity sha512-6jSFfXAR5/NcWTfCwGfWfzRN1IDpzRke8bZBH+nS0Yd9sHGQWhWjOlBl/SieAo2UrHa+DIEzhrCN61Yo+uAZ0g== +feathers-authentication-hooks@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/feathers-authentication-hooks/-/feathers-authentication-hooks-1.0.0.tgz#7a1d35f45baf0b7c8a15f72f49b67a2dba3d0b35" + integrity sha512-2mcOCHQHmYkwF+AIJo/uEyRlPxQ9LhZ5gEw898vcPqI3GDTZIvKAGHJCa1JDlWLbSzJcwE6It6gBFaYP/zXW6g== dependencies: - "@feathersjs/errors" "^3.3.0" - debug "^3.1.0" - lodash "^4.17.5" + "@feathersjs/errors" "^4.3.3" + debug "^4.1.1" + lodash "^4.17.15" feathers-hooks-common@^4.20.7: version "4.20.7" From 4e3756d6d6f13f5207c2813b4a1f9b6ef68bca3c Mon Sep 17 00:00:00 2001 From: Bervianto Leo Pratama Date: Fri, 4 Oct 2019 17:53:49 +0700 Subject: [PATCH 2/2] Changes new method --- src/services/users/users.hooks.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/users/users.hooks.js b/src/services/users/users.hooks.js index d9a5acb8..d2812fcc 100644 --- a/src/services/users/users.hooks.js +++ b/src/services/users/users.hooks.js @@ -5,7 +5,7 @@ const { const { hashPassword, protect } = require('@feathersjs/authentication-local').hooks; -const { restrictToOwner } = require('feathers-authentication-hooks'); +const { setField } = require('feathers-authentication-hooks'); const checkPermissions = require('feathers-permissions'); const restrict = [ @@ -16,9 +16,9 @@ const restrict = [ error: false }), iff(context => !context.params.permitted, - restrictToOwner({ - idField: 'id', - ownerField: 'id' + setField({ + from: 'params.user.id', + as: 'params.query.id' }) ) ];