scslab/hails — pull request #5 by alevy (2012-02-23 02:45:37+00:00)
Title: Small cleanup + dynamic loading of external databases

If a web app wants to talk to an external policy (one protected by a priviledge other than it's own), it can call:

withExternalDB "policy_petname"

which will give it back an `Action l p s a -> Action l p s a`

This is implemented by looking at a global config file (set in the environment and defaults to somewhere in /etc so developers can use their own on their local machines). Each line in the config file specifies a pet-name, module (whatever the policy writer uses...) and file location of the policy. Each policy is expected to have an entrance method:

withDB :: DCPrivTCB -> Action l p s a -> Action l p s a

The system will partially apply this method with the policies priviledges and the result becomes available to the web app.