Skip to content

Architectural Decisions Records

Maciej Szlosarczyk edited this page Sep 6, 2018 · 1 revision

2018-09-06 - Use one class for modeling all users

Context and Problem Statement

We need two tier user management: auction participants and administrators.

Given that auctions are blind and administrators will have access to current price of a domain during the auction, these two roles need to be mutually exclusive. An administrator cannot participate in an auction due to information asymmetry.

At the same time, User instances should not hold the permissions management itself, instead delegate that to some kind of role object.

Considered Options

  • Separate classes for Users and Administrators via single table inheritance.
  • Separate classes for Users and Administrators via different database tables.
  • Single User class, with separate Roles as Ruby objects.
  • Single User class, with separate Roles as Active Record objects.

Decision Outcome

Single User class, with separate Roles as Ruby objects.

  • Given that identity codes are required to be unique, it is easy to enforce separation of participants and administrators.
  • Maintains SRP. Users are used to identify people who will use auction center, and nothing more.
  • No need to introduce sophisticated permission management, as there are only 2 possible roles.