In this episode, we're doing a thorough check-up of our app's authorization—basically, we're making sure users can't sneakily update, archive, or add stuff they shouldn't be able to. We kick things off by looking at the current places where things like columns and cards can be updated, archived, or added, and realize we still need to lock things down in a few spots.
We start by adding policy methods for updating and archiving columns, making sure only the right users can do these actions. That means writing policy classes, plugging in some checks, and testing it out to see that, yep, the right permissions are enforced. We repeat this process for cards—creating update and archive methods in the card policy, making sure again only owners can perform these changes. Along the way, there's a quick detour to fix a bug where the notes field was required, but shouldn't be, just to keep things running smoothly.
Afterwards, we move on to adding new columns and cards. Here, we think carefully about which policy is responsible (board policy for columns, column policy for cards) and implement the same kind of ownership checks. We wire everything up, test things out in the UI, and see that authorization is working everywhere it needs to be.
So by the end of this episode, we've systematically tackled all those "who's allowed to do what?" questions, nailing down the access rules for boards, columns, and cards throughout the app. If you want to tweak or extend things later, all the patterns are now nicely in place!