bitcast/bitcast — pull request #118 by lukesteensen (2013-01-21 06:00:54+00:00)
Title: add roles to users

This adds a JSON serialized field `roles` to the user model and a `User#has_role?` method for checking them.

Example:
```ruby
current_user.roles = [:admin]
current_user.save
current_user.has_role? :admin # returns true
current_user.has_role? :superadmin # returns false
```

It is important to note that since it is JSON serialized, it will convert everything to JSON compatible values (i.e. symbols will be stored as strings).

The idea is that this field will always contain an array of strings, and we can add more helper functions (like `User#add_role` or something) when we need them. For now, its easy to give ourselves the admin role in the console and just use `has_role?` in the views.

Look it over; its pretty simple right now, so whoever wants to merge feel free.