OptimalBits / node_acl

Access control lists for node applications
2.62k stars 371 forks source link

Unexpected result from `isAllowed` #153

Closed ErikEvenson closed 9 years ago

ErikEvenson commented 9 years ago

This code:

  var acl = require('acl');
  acl = new acl(new acl.memoryBackend());

  acl.allow('eevenson', 'test', 'view', function(err) {
    acl.isAllowed('eevenson', 'test', 'view', function(err, allow) {
      console.log('xxx', err, allow);
    });
  });

logs xxx null false. I would have expected it to log xxx null true.

jonmassot commented 9 years ago

see isAllowed definition : https://github.com/OptimalBits/node_acl#isallowed-userid-resource-permissions-functionerr-allowed-

acl.isAllowed expect to have the userID where allow gives access to roles, not users. Or maybe I don't really understand your code.

ErikEvenson commented 9 years ago

@jonmassot perfect -- thanks. I missed the role/user layer of indirection. Closing.