1

I have been trying to integrate this acl package but I can't get it to do anything - even throw errors. I've distilled it down about as simple as I can get and this is basically exactly from the example in their documentation:

import * as nodeAcl from 'acl';

...(DB initialization and other stuff happens here)...

acl = new nodeAcl(new nodeAcl.mongodbBackend(mongoose.connection.db, "acl_"));

debug("Testing ACL...");

acl.allow('guest', 'blogs', 'view');
acl.addUserRoles('joe', 'guest');
acl.isAllowed('joe', 'blogs', 'view', function(err, res){
    if(res){
        debug("User joe is allowed to view blogs")
    }
    debug("Callback was called...");
});

debug("done testing acl");

I just get "Testing ACL..." and "done testing acl" to my debug output and that's it. No errors, nothing written to the DB (which is working fine - I can write/read with it). Just nothing happens. Even an error would be welcome.

WillyC
  • 3,917
  • 6
  • 35
  • 50
  • Seems like this: http://stackoverflow.com/questions/6442676/how-to-prevent-node-js-from-exiting-while-waiting-for-a-callback – Jack Dec 02 '16 at 01:21
  • I don't see how they are related - this is about an access control package, that link talks about a problem with node itself. What am I missing? – WillyC Dec 02 '16 at 14:34
  • It seems like node is finishing before your callback is called. – Jack Dec 02 '16 at 19:59
  • No - there's a whole project running around this code that works fine and stays up indefinitely. This was being added to an existing express app. From reading the acl github issues page it seems that mongodb support is questionable. – WillyC Dec 02 '16 at 20:02
  • Ah, ok. That wasn't clear (to me) from the original question. Good luck. – Jack Dec 02 '16 at 20:04
  • Yeah, I could see how that would be unclear. Sorry. – WillyC Dec 02 '16 at 20:05

0 Answers0