fixed an issue of filtering who can delete products, and added one set of permissions to view manage.

This commit is contained in:
Brian McGonagill 2022-08-25 20:15:03 -05:00
parent 7641b17e6f
commit 0690e70ebe
3 changed files with 9 additions and 12 deletions

View file

@ -57,13 +57,6 @@ Meteor.methods({
throw new Meteor.Error('You are not allowed to delete products. Make sure you are logged in with valid user credentials.');
}
let prodInfo = Products.findOne({ _id: prodId });
let myId = this.userId;
if (myId == prodInfo.prodOwner) {
return Products.remove({ _id: prodId });
} else {
console.log("User not allowed to delete this product. Not the owner!");
return("Not Allowed!");
}
return Products.remove({ _id: prodId });
}
});