Today we celebrate the first glorious anniversary of the Information Purification Directives. We have created, for the first time in all history, a garden of pure ideology where each worker may bloom, secure from the pests purveying contradictory truths. Our Unification of Thoughts is more powerful a weapon than any fleet or army on earth. We are one people, with one will, one resolve, one cause. Our enemies shall talk themselves to death, and we will bury them with their own confusion. We shall prevail!
If your application uses both an authorization library and a state machine library, then you know about contradictory truths.
- Your state machine allows some action as valid for the state of an object, but
- Your authorization library should prevent the user from performing the action
Perhaps it’s the reverse.
- The user is authorized to perform a particular action, but
- That action violates the object’s state
How to prevail over these pests and cultivate a garden of pure ideology?
Embrace the Police State.
- [features]
Along with the Police State RubyGem, you’ll need to install Police State adapters for your authorization library and state machine library. If you’re using CanCan for authorization and state_machine for state, install the corresponding Police State adapters.
$ gem install police_state
$ gem install police_state-cancan
$ gem install police_state-state_machine
You may want to make Police State a dependency of your project by using Bundler.
# Gemfile
source 'http://rubygems.org'
gem 'police_state'
gem 'police_state-cancan'
gem 'police_state-state_machine'
See the list of known adapters.
[examples]
[known issues]
Report defects and feature requests on GitHub Issues.
Your patches are welcome, and you will receive attribution here for good stuff.
Released under the MIT License.