loopback-getting-started-intermediate icon indicating copy to clipboard operation
loopback-getting-started-intermediate copied to clipboard

Restrict a reviwer can only able to read the reviews for he is owner of ?

Open shivashanmugam opened this issue 10 years ago • 3 comments

I was experimenting with this code for a time and i try to implement some like the below requirement.

Consider like there is no such option All Reviews. A Reviewer can able to read only his own reviews and My Reviews will list out only the reviews which he is owner of

For that i changed the excisting ACLs with the below ACLs

"acls": [
    {
      "accessType": "*",
      "principalType": "ROLE",
      "principalId": "$everyone",
      "permission": "DENY"
    },
    {
      "accessType": "EXECUTE",
      "principalType": "ROLE",
      "principalId": "$authenticated",
      "permission": "ALLOW",
      "property": "create"
    },
    {
      "accessType": "READ",
      "principalType": "ROLE",
      "principalId": "$everyone",
      "permission": "DENY"
    },
    {
      "accessType": "READ",
      "principalType": "ROLE",
      "principalId": "$owner",
      "permission": "ALLOW"
    },
    {
      "accessType": "WRITE",
      "principalType": "ROLE",
      "principalId": "$owner",
      "permission": "ALLOW"
    }

But after i execute the find reviews where publisherId={publisherId}, the result is a authorization error, http://localhost:3000/api/Reviews?filter=where publisherId="583b2d3bd7f0308f2054bfb9"

{
  "error": {
    "name": "Error",
    "status": 401,
    "message": "Authorization Required",
    "statusCode": 401,
    "code": "AUTHORIZATION_REQUIRED",
    "stack": "Error: Authorization Required\n    at /home/iss/Desktop/coderef/fbmashup/POC/loopback-getting-started-intermediate/node_modules/loopback/lib/application.js:399:21\n    at ...............etc}

So how this is possible through Without any Custom Remote method

shivashanmugam avatar Nov 27 '16 19:11 shivashanmugam

Please send a PR preferably with test cases.

Amir-61 avatar Jan 12 '17 20:01 Amir-61

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 23 '17 14:08 stale[bot]

This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS file at the top-level of this repository.

stale[bot] avatar Sep 06 '17 14:09 stale[bot]