json - Apply Access restriction to properties inside a model in loopback [Strongloop] -
i have model named employee , it's properties
"name":"", "dob":"", "location":""
some of default roles in loopback frameworks
$authenticated $everyone
i wanted to
1.allow $authenticated
roles on accessing model employee[read , write].
2.allow $everyone
role [read] model properties except location property [location allowed read role $authenticated]. ,
i added below config in employee.json, did't work.
{ "accesstype": "read", "principaltype": "role", "principalid": "$everyone", "permission": "allow" }, { "accesstype": "read", "principaltype": "role", "principalid": "$everyone", "permission": "deny", "property": "location" }
searched lot, not able find code.
what think can question 1) in employee.json
:
... "acls": [ { "accesstype": "*", "principaltype": "role", "principalid": "$everyone", "permission": "deny" }, { "accesstype": "read", "principaltype": "role", "principalid": "$authenticated", "permission": "allow" }, { "accesstype": "write", "principaltype": "role", "principalid": "$authenticated", "permission": "allow" } ] …
concerning question number 2) - think not possible in loopbackjs (not sure).
the property
attribute accessing custom methods (the remotemethods names) define in employee.js
file - not model's attributes.
Comments
Post a Comment