OptimalBits / node_acl

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

allowedPermissions always showing no permission even though admin status? #226

Closed scheung38 closed 7 years ago

scheung38 commented 7 years ago

It was working a few days ago but now even as admin, allowedPermissions still shows no privileges?

acl.allow([      
        // Example Roles
        {
            roles: 'admin',
            allows: [
                { resources: '/acl/secret', permissions: 'create' },
                { resources: '/acl/topsecret', permissions: '*' }
            ]
        },
        {
            roles: 'user',
            allows: [
                { resources: '/acl/secret', permissions: 'get' }
            ]
        }, {
            roles: 'guest',
            allows: []
        }
    ]);
    acl.addRoleParents('user', 'guest');  
    acl.addRoleParents('admin', 'user');  

this.acl.allowedPermissions(id, [ '/info', '/secret', '/topsecret'], function(error, permissions) {
            if (error) {
                return next(error);
            }
            response.json(permissions);

        });
    }

{
  "/info": [],
  "/secret": [],
  "/topsecret": []
}

But checking with: http://localhost:8001/acl/secret Welcome Sir!

http://localhost:8001/acl/topsecret Hi Admin!

Both seem to suggest that I am currently authorized as admin

whereas a few days ago when as admin:

http://localhost:8001/acl/info

{
  "/info": [],
  "/secret": [
    "create",
    "get"
  ],
  "/topsecret": [
    "*"
  ]
}