Policy support backend

Review Request #990 — Created Aug. 23, 2009 and discarded

Information

Review Board

Reviewers

This patch includes policy support for ReviewBoard. It includes the expression parser, a simple admin interface and a single action as a proof of concept.

This is a fully extensible parser, that already has a few operators to serve as an example and more operators can be used in the future.
The parser is based on a technique described in the book Beautiful Code, and has the advantage of being fast and creating a syntactic tree that can be evaluated under different contexts, and the disadvantage of having poor error messages for syntactic errors. This can be improved in latter versions using heuristics.

Actions should be checked through the helper function policy.applier.applies, conviniently imported under the name `policy_checks` in the example. That function was caching syntactic trees, but I couldn't get the cache invalidated, so I removed it.

I still don't know wether we should be using a reference to a string in the Policy class or a hardcoded string for action names, but in order to simplify the development I opted for the latter. More actions will have to be mapped for this patch to be considered complete, and those will come in future updates to this review.

Also, there should be enough semantic in the operators themselves that an builder is feasible for a limited number of expressions. Also, the manual should be automatically generated, so should a syntax helper on the side of the screen.

This review was migrated from: http://reviews.review-board.org/r/970/
The parser was tested a lot. The rest was tested only in Safari.
edufelipe
Review request changed
Status:
Discarded