News for hackers. Stuff that matters.
Re:Distributed Authorization by AndrewHampton on Tuesday April 16, 2024 @04:48PM (#40056996)
> A team I worked with in the past came to the same conclusion - turning authorization rules into WHERE clauses is a very efficient way to solve this problem, if you can figure out a clean way to do it.

For rails specifically, https://github.com/polleverywhere/moat was built with this in mind. It's heavily inspired by Pundit, but let's you write policies at the `ActiveRecord::Relation` level. So `policy_filter(Article).find_by!(id: params[:id])` would run something like `select * from articles where id = ? and id in (select id from articles where owner_id = ?);`.

Re:Distributed Authorization by mackross on Tuesday April 16, 2024 @10:08PM (#40059670)
Nice library