Skip to content

Commit

Permalink
Merge pull request #1869 from onepercentclub/bugfix/BB-5562-donate-re…
Browse files Browse the repository at this point in the history
…ward-as-guest

Fix IsOrderCreator working for orders, payments and donations
  • Loading branch information
aethemba committed Jan 20, 2016
2 parents 61c40be + 7c8a5c3 commit ea1d1cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bluebottle/bb_orders/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class IsOrderCreator(permissions.BasePermission):
"""

def has_object_permission(self, request, view, obj):
# Use duck typing to check if we have an order or a payment.
if hasattr(obj, 'user'):
order = obj
else:
# Use duck typing to check if we have an order or a payment/donation.
if hasattr(obj, 'order'):
order = obj.order
else:
order = obj

# Permission is granted if:
# * the order user is the logged in user
Expand Down

0 comments on commit ea1d1cc

Please sign in to comment.