I'm back at trying to figure out the the static role-based access in Loopback and once again I am stuck. I'm in need of basic role-based authorization.
{"name": "orgAdmin", "description": "Organization Administrator"} This worked fine, and the role was created.{"email":"em...@email.com", "password":"111111"} I verified the account was created by logging in. Again, worked great.{
"principalType": "USER",
"principalId": "535dd89cf95491442a2e5e97"
} This seems to have worked fine as well. I also used the roleMapping rest API specifically where I pass the roleId, principalType, and principalId like above they they seem to both update the role principals."org": {
"options": {
"acls": [
{
"accessType": "*",
"permission": "DENY",
"principalType": "ROLE",
"principalId": "$everyone"
},
{
"accessType": "*",
"permission": "ALLOW",
"principalType": "ROLE",
"principalId": "orgAdmin"
}
]
},
"properties": {
"orgName": {
"type": "string"
}
},
"public": true,
"dataSource": "db",
"plural": "orgs"
}My issue is that once I enable Auth (app.enableAuth()), my user (who is supposed to be an orgAdmin) does not have access to perform any methods on the org model. If I change the principalId from "orgAdmin" to "$authenticated" then I do have access to GET and POST.
So what have I done wrong here? I'm following this doc:http://docs.strongloop.com/display/DOC/Defining+roles.
loopback 1.7.x
Any assistance is appreciated. Thanks
--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I'll give it a go. Thanks again
Here is a hint for debugging the security bits in loopback:`DEBUG=loopback:security:* node app.js`This will print out a lot of useful info about the AccessContext / token / etc.
"acls": [{
"principalType": "ROLE","principalId": “orgAdmin","permission": "ALLOW"},{"principalType": "ROLE",
"principalId": "$everyone","property": "create","permission": "DENY"}