As part of putting together a design strategy for implementing role-based access on the Partner Dashboard, I found a number of ways that the Pundit Policy code could be refactored. Putting that together before starting the bigger process seemed nice! There's definitely more cleanup that could be done, but I wanted to do this while I was thinking about it!
Description of Changes:
This change:
renames some misnamed specs
fixes the user_policy_spec to be actually checking the UserPolicy class
abstracts out some similar methods in the children Policy classes
moves a duplicated check for whether a user is admin to the BasePolicy class
removes children Policy class initializers, as none of them were doing anything that wasn't accomplished in the BasePolicy class
PR Checklist:
[ ] Have you linted and tested your code locally prior to submission?
[ ] Have you tagged the appropriate dev(s) for review?
[ ] Have you linked to any relevant tickets or conversations?
PR Review Standards:
Consider using Conventional Comments to ensure that your feedback is clear and actionable.
Ideally, PRs should be reviewed by at least 2 team members.
Relevant Ticket or Conversation:
As part of putting together a design strategy for implementing role-based access on the Partner Dashboard, I found a number of ways that the Pundit Policy code could be refactored. Putting that together before starting the bigger process seemed nice! There's definitely more cleanup that could be done, but I wanted to do this while I was thinking about it!
Description of Changes:
This change:
PR Checklist:
PR Review Standards: