davidjsevans/codetry — pull request #25 by Bazay (2013-05-09 03:41:07+00:00)
Title: Added Role Permissions

Added role permissions:

VIP
- Can read all
- Can edit poems

user
- Can create a poem
- Can edit/destroy their own poems

everyone else
- Can read poems

README:
Routes have not been implemented yet, therefore the permissions cannot currently be tested. However once routes have been implemented, users who are not admin will not be able to access certain index pages etc.

Furthermore, showing buttons specific to users (for example, showing an edit button when the current user is the creator, or is an admin, etc.) should be implemented by adding following code, instead of testing for current_user roles.

<% if user_signed_in? %>
<% if can? :edit, @post %>
show button
<% end %>
<% end %>