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

750 allow orders to be viewed #777

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

tekHudson
Copy link
Member

fixes #750

tamouse added 5 commits March 27, 2021 11:27
This commit fixes a problem where non-super-admins cannot view an order once it's been submitted.

- Update the controller to check if the current user is allowed to view the order chosen
  when they are not allowed to edit the order.

- Add a permission check for viewing an order.

- Add a show view to the orders views.

- Update several partials to only display buttons that can modify the order and not when
  the user can only view the order.

- Add some test cases and fixtures to verify the function of Users::OrderManipulator.
Ensure correct templates rendered and redirects based on user.
If user calls edit action but is not allows to edit, redirects to show action (order_path(@order))

Show action shows if user is allowed, otherwise redirects to index action (orders_path)

routes for orders resource now excludes only :destroy action
Shows logic inherent in permissions, moves logic based on status to private method.

This passes rubocop's length rules while keeping the necessary logic in front
@tekHudson tekHudson self-assigned this Mar 27, 2021
@tekHudson tekHudson added the WIP label Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a way for non-super-admin users to view orders that they cannot edit
2 participants