OptimalBits / node_acl

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

I need superadmin, what can i do with node_acl? #276

Open snowdream opened 5 years ago

snowdream commented 5 years ago

I need superadmin, who have all permissions on all the resources.

what can i do with node_acl?

xiemoumou commented 4 years ago

do nothing, go ahead your router without middleware

AbdelrahmanHafez commented 4 years ago

@xiemoumou I don't think that's what @snowdream means.

I believe they have a case where some resources require roles, but they need a role that has access to all resources.

One way to do this is to add this superadmin role as a parent to all roles:

const acl = require('acl');
const memoryBackend = new acl.memoryBackend();
const aclInstance = new acl(memoryBackend);

aclInstance.addRoleParents('superadmin','admin');
aclInstance.addRoleParents('superadmin','customer');
aclInstance.addRoleParents('superadmin','agent');
aclInstance.addRoleParents('superadmin','finance');
aclInstance.addRoleParents('superadmin','content');

module.exports = aclInstance;

And use that instance for all your resources. I am sure there is a better way to achieve this, but this is one that works for now.

xiemoumou commented 4 years ago

@AbdelrahmanHafez i'm sorry for my misunderstandingļ¼Œit works in your way.

xiemoumou commented 3 years ago

hey, there is a new module for this, view it in https://github.com/xiemoumou/node_acl

AbdelrahmanHafez commented 3 years ago

@xiemoumou The link redirects to the current repo when clicked, people would need to copy & paste it in order to work, you probably need to edit it.