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

The arguments passed to userIsInRole() seems in the wrong order. #2657

Closed
tespher opened this issue Aug 9, 2017 · 2 comments
Closed

The arguments passed to userIsInRole() seems in the wrong order. #2657

tespher opened this issue Aug 9, 2017 · 2 comments
Assignees
Labels
bug For issues that describe a defect or regression in the released software

Comments

@tespher
Copy link

tespher commented Aug 9, 2017

In master branch, release 1.4.0.
reaction/imports/plugins/core/checkout/client/templates/checkout/login/login.js
line 21:
const anonUser = Roles.userIsInRole("anonymous", Meteor.user(), Reaction.getShopId());

According to the Role API document :
http://alanning.github.io/meteor-roles/classes/Roles.html#method_userIsInRole
userIsInRole ( user roles [group] ) Boolean
Defined in roles/roles_common.js:254

The order of 1st and 2nd argument should be reversed:
const anonUser = Roles.userIsInRole(Meteor.user(), "anonymous", Reaction.getShopId());

The consequence of this issue is:
When I checkout without logged in and click "Continue as Guest" in first step, the "Welcome, it's so good to see you." message will be displayed and go to 2nd step.(checkoutLoginCompleted returned true)

If userIsInRole is invoked with correct argument order, the 1st step will keep its display and just go to 2nd step.(checkoutLoginCompleted returned false)

I am not sure which one is the expected behavior.

@aaronjudd aaronjudd added the bug For issues that describe a defect or regression in the released software label Aug 14, 2017
@aaronjudd
Copy link
Contributor

We should also be replacing Roles.userIsInRole with Reaction.getPermission() in all cases now that Meteor 1.5.1 supports use of Meteor.getUserId() within publications.

@spencern
Copy link
Contributor

Resolved by #2752

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For issues that describe a defect or regression in the released software
Projects
None yet
Development

No branches or pull requests

4 participants