OptimalBits / node_acl

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

remove user #272

Open Trenrod opened 5 years ago

Trenrod commented 5 years ago

Hi, cannot find a function to remove a user. E.g. when a user unregisters I want to complete clean up everything from him also the db entries with _bucketname users.

Or do I have to delete it manually? Thank you.

shawnzxx commented 5 years ago

I have same issue to remove the user from acl_users and acl-meta tables.

RuneSP commented 5 years ago

+1

Trenrod commented 5 years ago

Tried to clean it up by myself. But stuck in a performance issue deleting resources

        const ressources = await aclhelper.acl.whatResources(accountRoleKey);
        if (ressources != null && Object.keys(ressources).length > 0) {
          for (let idx = 0; idx < Object.keys(ressources).length; idx++) {
            await aclhelper.acl.removeAllow(accountRoleKey, Object.keys(ressources)[idx], "*");
            // Takes >40sec having 3k roles
            await aclhelper.acl.removeResource(Object.keys(ressources)[idx]);
          }
        }

https://github.com/OptimalBits/node_acl/issues/189