OptimalBits/node_acl — pull request #15 by cboulanger (2012-09-15 19:44:27+00:00)
Title: MongoDB backend -Updated

Hi!

Here's a pull request that adds a MongoDB backend. It passes all but the two last tests, resulting in 4-5 broken vows. I couldn't figure out what the problem is, but since the number of broken vows is changing, I suspect there is some race condition involved. The problem seems to be related to "removeResources". Maybe you have an idea what could be wrong. I'd be really grateful if you could pull my changes on a test branch and have a look - since MOST of the tests are passing, my code cannot be that bad.

For this to work, I had to change the test runner file. Because of the async problem that I have already written about in my issue, I had to put the test suit into a function that is called once the database connection has been established. That makes it impossible to export the batch, it has to be run instead. I hope this is ok with you - or maybe you know how else to solve the problem. Is it really necessary to export(module)?

I also added an unversioned "run_tests.js" file that contains the configuration details and is run instead of "acl_test,js". Connection details/authentication credetials shouldn't be put into the versioned and published code. There is a "run_tests.js.dist" which needs to be renamed and edited. Does that make sense to you?

I very much hope this is useful and you can spot the problem quickly, so that an "official" MongoDB backend can be added quickly to node_acl. Thanks for your time.