= Declarative Authorization with I18n support This is a fork of Steffen Bartsch's declarative_authorization[http://github.com/stffn/declarative_authorization/tree] equipped with localization based on Rails default I18n. = Requirements * Rails 2.2 or above = Installation One of three options to install the plugin: * Install by Gem: Add to your environment.rb in the initializer block: config.gem "rubycs-declarative_authorization", :lib => "declarative_authorization" And call from your application’s root directory rake gems:install * Alternatively, to install from github, execute in your application’s root directory cd vendor/plugins && git clone git://github.com/rubycs/declarative_authorization.git * Or, download one of the released versions from Github at github.com/rubycs/declarative_authorization/downloads = Usage * Please check the original documentation[http://github.com/stffn/declarative_authorization/tree] for detailed instructions. * Or, simply ** create a basic localization file. The original English file config/locales/en.declarative_authorization.yml looks like: en: declarative_authorization: # app/controllers/authorization_rules_controller.rb error_in_call_to_graphviz: Error in call to graphviz # app/helpers/authorization_rules_helper.rb rules: Rules graphical_view: Graphical view usages: Usages no_filter_access_to_call_protects_this_action: No filter_access_to call protects this action action_is_not_protected_with_attribute_check: Action is not protected with attribute check privilege_set_automatically_from_action_name_by_all_rule: Privilege set automatically from action name by :all rule context_set_automatically_from_controller_name_by_filter_access_to_call_without_context_option: Context set automatically from controller name by filter_access_to call without :context option # app/views/authorization_rules/graph.html.erb authorization_rules_graph: Authorization Rules Graph privilege_hierarchy: Privilege hierarchy currently_active_rules_in_this_application: Currently active rules in this application. all_rules: All rules all_contexts: All contexts effective_privileges: Effective privileges show_full_privilege_hierarchy: Show full privilege hierarchy zoom_in: Zoom in zoom_out: Zoom out # app/views/authorization_rules/index.html.erb authorization_rules: Authorization Rules # app/views/authorization_usages/index.html.erb authorization_usage: Authorization Usage filter_rules_in_actions_by_controller: Filter rules in actions by controller # lib/declarative_authorization/in_controller.rb you_are_not_allowed_to_access_this_action: You are not allowed to access this action ** create a config/authorization_rules.rb file like authorization do role :guest do #has_permission_on :welcome, :to => :read end end privileges do privilege :manage, :includes => [:create, :read, :update, :delete] privilege :read, :includes => [:index, :show] privilege :create, :includes => :new privilege :update, :includes => :edit privilege :delete, :includes => :destroy end ** add filter_access_ro :all in a controller. When navigating to the controller an Access Denied message should be present. = Licence MIT