Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider is undefined when using restrictToRoles #525

Closed
eikaramba opened this Issue Jun 13, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@eikaramba
Copy link
Contributor

eikaramba commented Jun 13, 2017

This might be related to #432, however i'm using feathers-rest.

Steps to reproduce

server is using these hooks for user model:

const auth = require('feathers-authentication').hooks;
const { restrictToOwner,restrictToRoles } = require('feathers-authentication-hooks');

    get: [
      auth.authenticate('jwt'),
      restrictToRoles({
         roles: ['admin'],
         fieldName: 'group',
         idField: 'id',
         ownerField: 'id',
         owner: true
      }),
      custom_method()
    ],

client is calling normally with:
this.api.service('users').get(payload.userId)

Expected behavior

hook.params.provider should be set to "rest" when checking inside of custom_method()

Actual behavior

provider is undefined. When i comment out the line for restrictToRoles, it works as expected.

System configuration (latest as of 13.06.2017)

feathers-2.1.2
feathers-rest-1.7.2
feathers-authentication-1.2.4
feathers-authentication-client-0.3.2
feathers-hooks-2.0.1
feathers-commons-0.8.7
feathers-hooks-common-3.5.1

@eikaramba eikaramba changed the title Provider is undefined when using authenticate Provider is undefined when using restrictToRoles Jun 13, 2017

@eikaramba

This comment has been minimized.

Copy link
Contributor Author

eikaramba commented Jun 13, 2017

i just saw that i posted this to the wrong repo. i'm very sorry, it is sometimes really confusing with all these repositories. should i move it?

@marshallswain

This comment has been minimized.

Copy link
Member

marshallswain commented Jun 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.