javascript - How to set up the ACL to allow everyone list all the Users from the REST API -
im trying list users in loopback 2.0 app using rest api , i'm getting following error:
{ "error": { "name": "error", "status": 401, "message": "authorization required", "statuscode": 401, "stack": "...." } }
i manually added acl model-config.json file:
"user": { "datasource": "db", "acls": [ { "principaltype": "role", "principalid": "$everyone", "permission": "allow", "accesstype": "*" } ] },
since failed, created model based on user built-in model:
{ "name": "admin", "base": "user", "properties": {}, "validations": [], "relations": {}, "acls": [ { "principaltype": "role", "principalid": "$everyone", "permission": "allow", "accesstype": "*" } ], "methods": [] }
but in rest api still have same issue:
{ "error": { "name": "error", "status": 401, "message": "authorization required", "statuscode": 401, "stack": "....." } }
i appreciate help. =)
we should allow further configure built-in model additional acls. todo loopback.
you can subclass built-in user model in common/user.json have illustrated.
{ "name": "user", "base": "user", "plural": "users" }
then need expose rest adding entry server/model-config.json, such as:
"user": { "datasource": "db", "public": true },
Comments
Post a Comment