README.md in rolypoly-0.0.5 vs README.md in rolypoly-0.1.0

- old
+ new

@@ -21,11 +21,11 @@ ## Usage ```ruby class ApplicationController < ActionController::Base - def current_roles + def current_user_roles current_user.roles end rescue_from(Rolypoly::FailedRoleCheckError) do render text: "Failed Authorization!", status: 401 @@ -55,17 +55,42 @@ # Allow admin role to access all actions of this controller allow(:admin).to_all # Make action public restrict(:landing).to_none + # OR publicize :landing def landing # ... end # Give up and make all public all_public +end + +# Want some more complex role handling? +class ProfilesController < ApplicationController + allow(:admin).to_access(:index) + allow(:owner).to_access(:edit) + publicize(:show) + + def index + current_roles # => [#<SomeCustomRoleObject to_role_string: "admin", filters: [...]>] + end + + def edit # Raises permission error before entering this + current_roles # => [] + end + + def show + current_roles # => [] + end + + def current_user_roles + current_user.roles # => [#<SomeCustomRoleObject to_role_string: "admin", filters: [...]>, #<SomeCustomRoleObject to_role_string: "scorekeeper", filters: [...]>] + end + private :current_user_roles end ``` ## Contributing