mochify/co-squared — Issue #2: Create and finalize the User and Role models
Author: mochify
Created: 2011-11-13 20:41:29+00:00
State: open

Users are the people who are registered with a specific blog. Each user is also associated with various roles (like writer, administrator, moderator, etc. etc.).

User model should have fields for at least the basics:

* user name - for logging in (can default to email)
* email
* first name
* last name
* password - This should be the hash of the password. bcrypt is probably a really good choice here because it's a slow algorithm and should be much more resilient to attack than straight hashing via SHA or what have you.
* active - whether a user is active or not
* creation date - when this user was created
* last_login - keeping track of when this user last logged in

Has a relation to Role. As a user can be bound to many roles. This is a has-and-belongs-to-many relationship.

Role model is going to be rather simple, to start it can probably look like this:

* role_id - some constant ID identifying this role
* name - The user friendly name of this role
* description - An explanation of what this role is

This task does not consider a system that features custom roles, as there is zero driver for such a system at this time.