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

Basic pundit setup with OrderPolicy on create #169

Merged
merged 1 commit into from
Jun 1, 2024

Conversation

jonny5
Copy link
Collaborator

@jonny5 jonny5 commented Jun 1, 2024

  • Needs to be integrated into a (currently not existing) controller with the line authorize @order to be useful

For issue: #163

@jonny5 jonny5 force-pushed the jonny5/permissions-creation-163 branch from c58759d to e9429c9 Compare June 1, 2024 18:35
Comment on lines 4 to 7
def initialize(user, order)
@user = user
@order = order
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want, you can create a BasePolicy class that other classes inherit from so we don't have to redefine initialize every time, e.g.:

https://github.com/18F/identity-dashboard/blob/8b06d08356cd0bf21558613168001987c5d4e0a4/app/policies/base_policy.rb#L1-L7

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 wasn't sure what defaults would be good, I ran rails g pundit:install which sets up the basic defaults and am now inheriting from that policy

- Needs to be integrated into a controller with `authorize @order` to be useful
- Add a default ApplicationPolicy using `pundit install`
@jonny5 jonny5 force-pushed the jonny5/permissions-creation-163 branch from 582c53d to 0781b68 Compare June 1, 2024 21:01
@abachman abachman merged commit a3b67f9 into main Jun 1, 2024
1 check passed
@abachman abachman deleted the jonny5/permissions-creation-163 branch June 1, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants