node_acl
node_acl copied to clipboard
removeResource leaves empty 'allows' collection
As I understand it, with mongodB backend, acl_allows.... collections store permissions under role keys. To remove a resource from the system, .removeResource deletes all the roles keys from the resource's acl_allows collection using collection.remove, leaving an empty collection there. Why do this instead of dropping the whole collection with collection.drop?
i.e. define an additional drop method on the backend interface as follows
drop : function(transaction, bucket){
contract(arguments).params('array', 'string').end();
var _this = this;
var collName = (_this.useSingle? aclCollectionName : bucket);
transaction.push( function(cb){
_this.db.collection(_this.prefix + collName, function(err, collection) {
if (err instanceof Error) return cb(err);
collection.drop( cb );
});
});
},
and then call backend.drop instead of backend.del in .removeResource - or if the present behavior is still desired, define an additional method, e.g. .deleteResource.
+1
Same problem, this leaves the database polluted with many empty collections!