Juarez Lustosa
All projects

Profile-based authorization for a billing platform

A permission model flexible enough for finance teams to define their own roles, built as a consultant for Ordway.

Company
Ordway (via Codeminer42)
Role
Consultant and backend developer
Period
2019 — 2020
Stack
  • Ruby on Rails
  • React
  • PostgreSQL
  • Redis
  • Heroku

The problem

Ordway is a billing and revenue platform. Its customers’ finance teams needed fine-grained control over who could see invoices, edit plans or run payouts, and a fixed set of roles was never enough: every customer wanted a slightly different split.

What I did

I designed and implemented the authorization system end to end, from the data model to the admin screens, and fixed a set of production configuration problems on Heroku along the way.

How I solved it

Permissions are declared once, as resource and action pairs. A profile is a named set of permissions, and a user can hold several profiles. Authorization checks are resolved from a per-request cache in Redis so the many checks a page makes do not hit the database. The admin UI in React lets a customer administrator compose profiles without engineering involvement.

What was hard

Making a flexible model safe. Profiles that overlap can grant more than intended, so the system shows the effective permissions of a user as the union of their profiles and flags sensitive actions that come from more than one profile.

The result

Customers could define roles that matched their own approval flows, and support requests to “change what this role can do” stopped reaching engineering.

Where to see it

Internal to the product. The model is described above.