Skip to content

Commit

Permalink
Merge pull request #129 from zainfathoni/master
Browse files Browse the repository at this point in the history
Fix view permission checking in order query
  • Loading branch information
wesbos committed Dec 7, 2018
2 parents 44a7fbe + 85438f8 commit 1364d73
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion finished-application/backend/src/resolvers/Query.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Query = {
// 3. Check if the have the permissions to see this order
const ownsOrder = order.user.id === ctx.request.userId;
const hasPermissionToSeeOrder = ctx.request.user.permissions.includes('ADMIN');
if (!ownsOrder || !hasPermission) {
if (!ownsOrder && !hasPermissionToSeeOrder) {
throw new Error('You cant see this buddd');
}
// 4. Return the order
Expand Down
2 changes: 1 addition & 1 deletion stepped-solutions/53/backend/src/resolvers/Query.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Query = {
// 3. Check if the have the permissions to see this order
const ownsOrder = order.user.id === ctx.request.userId;
const hasPermissionToSeeOrder = ctx.request.user.permissions.includes('ADMIN');
if (!ownsOrder || !hasPermission) {
if (!ownsOrder && !hasPermissionToSeeOrder) {
throw new Error('You cant see this buddd');
}
// 4. Return the order
Expand Down
2 changes: 1 addition & 1 deletion stepped-solutions/54/backend/src/resolvers/Query.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Query = {
// 3. Check if the have the permissions to see this order
const ownsOrder = order.user.id === ctx.request.userId;
const hasPermissionToSeeOrder = ctx.request.user.permissions.includes('ADMIN');
if (!ownsOrder || !hasPermission) {
if (!ownsOrder && !hasPermissionToSeeOrder) {
throw new Error('You cant see this buddd');
}
// 4. Return the order
Expand Down

0 comments on commit 1364d73

Please sign in to comment.