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. =)

  1. we should allow further configure built-in model additional acls. todo loopback.

  2. 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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -