No commit activity in last 3 years
No release in over 3 years
declarative_authorization_padrino is a Padrino's wrapper around declarative_authorization's Rails plugin for maintainable authorization based on readable authorization rules.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Declarative Authorization wrapper for Padrino¶ ↑

Read github.com/stffn/declarative_authorization for everything else but how to secure your controllers.

Securing your controllers¶ ↑

Although it’s not the best approach and it has to be improved, it’ll do the job for now. Suggestions accepted :)

Register the module in your app/app.rb

register Authorization::Padrino

For each action on your controller you’d like to protect add something like this:

:protect => [{:action => :read, :resource => :users, :forbidden => "Custom 403 forbidden message"}]

Note that :forbidden is optional.

get '/', :provides => :json, :protect => [{:action => :read, :resource => :users}] do
  User.with_permissions_to.all.to_json(:include => :roles)
end

And that’s pretty much it :)

Demo app¶ ↑

github.com/dariocravero/declarative_authorization_padrino_demo_app