node_acl icon indicating copy to clipboard operation
node_acl copied to clipboard

Tables acl_users and acl_meta. Required clarifications

Open andrejp opened this issue 9 years ago • 2 comments

Hello,

I would like to clarify few aspects. I am using MonogoDB for storing ACL data

Function addUserRoles add record to acl_users and acl_meta documents. However when I run removeUserRoles function records remains in acl_users and acl_meta.

Is this expected behaviour ? Could you please clarify what is the correct way to remove data from acl_users and acl_meta ?

Thank you very much,

Best Regards, Andrew

andrejp avatar May 30 '16 06:05 andrejp

+1, I can be wrong, but seems that meta/users is never used in code, only write/remove meta/roles is reads only once, in other places same, only write/remove in removeResource

...
 return this.backend.getAsync(this.options.buckets.meta, 'roles')
...

not best way to handle it. I have a lot of roles, in app and managing meta's now a bottleneck.

mogadanez avatar Aug 24 '16 15:08 mogadanez

removeResource is also a bottleneck on my side.

Acl.prototype.removeResource = function(resource, cb){
  contract(arguments)
    .params('string', 'function')
    .params('string')
    .end();

  var _this = this;
  return this.backend.getAsync(this.options.buckets.meta, 'roles').then(function(roles){
    // having deeb hirarchy roles are over 3000 in my case
    var transaction = _this.backend.begin();
    _this.backend.del(transaction, allowsBucket(resource), roles);
    roles.forEach(function(role){
      _this.backend.remove(transaction, _this.options.buckets.resources, role, resource);
    })
    return _this.backend.endAsync(transaction);
  }).nodeify(cb)
};

Trenrod avatar Nov 22 '18 10:11 Trenrod