NUBIC/ncs_staff_portal — pull request #2 by yipdw (2012-11-30 09:58:38+00:00)
Title: Proposed machine account authorization system

This pull request (which isn't done yet) contains a proposal for a machine account authorization system that can remove many hard-coded cases in Ops' controllers.

The gist of it:

1. A new Aker authority, `Aker::Authorities::MachineAccount`, creates and amplifies known machine accounts.
2. A new model, `MachineAccount`, acts like a `Staff` record insofar as it can supply roles for various services.
3. The controllers no longer use `Staff.find_by_username` to locate staff member records. They now use a different method that can integrate `MachineAccount` lookups. (Currently, it's called `Staff.by_username`, but could be changed further to e.g. `User.by_username` or whatever, if you consider staff members and machine accounts to both be "users".)

As mentioned above, this isn't yet finished. I'll continue working on it and will update this pull request when it's ready for further consideration.