mdsol/the_policy_machine — pull request #11 by HonoreDB (2014-01-30 22:20:29+00:00)
Title: Accept strings/symbols in is_privilege? to avoid having to serialize operations

Modifies PolicyMachine `is_privilege?` to accept the string "write" instead of a `PM::Operation` object with uuid "write", and modifies the optimized `is_privilege?` method in the ActiveRecord adapter so that sticks the string into its where condition rather than fetching the object from the database. This prevents a stateless consumer of the policy machine from needing to fetch the operation from the database before calling `is_privilege?`, which should reduce overhead.

In theory one could do this with the user and the object too, but it's nontrivial.

```
Finished in 1 minute 49.15 seconds
726 examples, 0 failures, 4 pending
Coverage report generated for RSpec to /Users/aweiner/the_policy_machine/coverage. 664 / 666 LOC (99.7%) covered.
```