parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

The requiresAuthentication doesn't behave the way docs explained.

Open pungme opened this issue 9 years ago • 5 comments

Issue Description

The requiresAuthentication doesn't behave the way docs explained.

Steps to reproduce

We tried to set our database's schema by following the parse-server (http://docs.parseplatform.org/parse-server/guide/#requireauthentication) documentation. As the docs stated For example, you want to allow your authenticated users to find and get objects from your application and your admin users to have all privileges, you would set the CLP:

"class_permissions": {
{
    "find": {
      "requiresAuthentication": true,
      "role:admin": true
    },
    "get": {
      "requiresAuthentication": true,
      "role:admin": true
    },
    "create": { "role:admin": true },
    "update": { "role:admin": true },
    "delete": { "role:admin": true },
  }
}

Expected Results

Authenticated users should be able to "find" and "get" objects and admin users have all privileges

Actual Outcome

Authenticated users got {"code":119,"error":"Permission denied for action find on class ClassName."} Only admin can do "find" and "get". But once we set something like this, it works as docs explained

"class_permissions": {
{
    "find": {
      "requiresAuthentication": true
    },
    "get": {
      "requiresAuthentication": true
    },
    "create": { "role:admin": true },
    "update": { "role:admin": true },
    "delete": { "role:admin": true },
  }
}

this works as we wanted to. Is this expected behaviour? or we understood the documentation wrong?

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 2.3.8
    • Operating System: Linux
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): AWS
  • Database

    • MongoDB version: 3.2.11
    • Storage engine: WiredTiger
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): mLab

Logs/Trace

{"code":119,"error":"Permission denied for action find on class ClassName."}

pungme avatar Apr 25 '17 14:04 pungme

I'll have a look

flovilmart avatar Apr 25 '17 14:04 flovilmart

In get method definition has a typing error... "requireAuthentication". Is it possible that your code is not like that for "find" too?

paulovitin avatar Apr 25 '17 19:04 paulovitin

Hey @paulovitin 😊 We tried fix the Typo, but the results still the same.

pungme avatar Apr 26 '17 08:04 pungme

I see that in the tests we don't cover explicitly that case, I'll have a look soon enough

flovilmart avatar Apr 26 '17 11:04 flovilmart

This will be part of the next release. Closing!

flovilmart avatar May 13 '17 15:05 flovilmart