Readme.markdown in checkpoint-0.2.1 vs Readme.markdown in checkpoint-0.2.2

- old
+ new

@@ -16,11 +16,11 @@ To enable a user to access/use a resource you must specify an authorisation rule to grant access. This is done using the "authorise" (or "authorize" for americans) method in the application controller. So if for instance you wanted to grant access (to all users) to your posts index action you could do the following: ```ruby -#grant access your posts controller 'index' action to all users +#grant access to your posts controller 'index' action to all users authorise "PostsController::index" #or authorize "PostsController::index" ``` @@ -49,11 +49,11 @@ ``` If you want to be able to grant access to your view action to only users who have signed in, you can do this by passing a block that returns true if the user is logged in. ```ruby -#grant access your posts controller 'view' action to all users who have signed in +#grant access to your posts controller 'view' action to all users who have signed in authorise "PostsController::view" do !current_user.nil? end ``` @@ -83,9 +83,19 @@ ```ruby authorise "Devise::*" ``` +### How do I enable an API Key? + +```ruby +#grant access to all controllers in the Api namespace for requests which have the API key as a param +authorize "Api::*" do + params[:api_key] == API_KEY +end + +``` + ## License Checkpoint is released under the MIT license: