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

Fix checkout login permissions #2752

Merged
merged 18 commits into from
Sep 14, 2017
Merged
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { Meteor } from "meteor/meteor";
import { Template } from "meteor/templating";
import { Roles } from "meteor/alanning:roles";
import { Reaction } from "/client/api";
import { Cart } from "/lib/collections";


/**
* checkoutLoginCompleted
* returns true if we've already past this stage,
* or if the user is a guest but not anonymous
* or if the user is a guest
*/

Template.checkoutLogin.helpers({
Expand All @@ -18,9 +17,8 @@ Template.checkoutLogin.helpers({
if (cart && cart.workflow) {
const currentStatus = cart.workflow.status;
const guestUser = Reaction.hasPermission("guest", Meteor.user());
const anonUser = Roles.userIsInRole("anonymous", Meteor.user(), Reaction.getShopId());

if (currentStatus !== self.template && guestUser === true && anonUser === false) {
if (currentStatus !== self.template && guestUser === true) {
return true;
}
}
Expand Down