-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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: Order of any kind should not be deleted except by admin #6573
fix: Order of any kind should not be deleted except by admin #6573
Conversation
Codecov Report
@@ Coverage Diff @@
## development #6573 +/- ##
==============================================
Coverage ? 65.44%
==============================================
Files ? 300
Lines ? 15297
Branches ? 0
==============================================
Hits ? 10011
Misses ? 5286
Partials ? 0
Continue to review full report at Codecov.
|
@iamareebjamal Please review. |
@iamareebjamal Please review this. |
This can only be finalized when frontend roles are checked to have no discrepancies. So, for now, create a PR allowing only admin to delete the orders |
2245755
to
92e8bc8
Compare
@iamareebjamal Please review. |
@iamareebjamal Done. |
@@ -438,8 +434,7 @@ def after_update_object(self, order, data, view_kwargs): | |||
order.event.name, order.identifier) | |||
|
|||
# This is to ensure that the permissions manager runs and hence changes the kwarg from order identifier to id. | |||
decorators = (jwt_required, api.has_permission( | |||
'auth_required', methods="PATCH,DELETE", model=Order),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've now removed the option of patching orders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal Nopes. Tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested what? Can a user PATCH an order created by itself and only itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal Yes.
open-event-server/app/api/orders.py
Line 324 in 931127b
if (not has_access('is_coorganizer', event_id=order.event_id)) and (not current_user.id == order.user_id): |
@kushthedude Please review |
Can admin still delete orders ? |
Yes, please see the code in File changes |
@kushthedude Ping |
Fixes #6567
Short description of what this resolves:
An Order cannot be deleted.
Checklist
development
branch.