Permission denied to query class in the Parse Server with JS SDK

1.5k Views Asked by At

I created a class in my Parse Server, using the Parse Dashboard, and then I changed the Class Level Permissions to allow only one user to perform read and write operations in the documents of this class:

Class Level Permissions

The user that is supposed to have access to this class was also created manually through the Parse Dashboard and it looks like this:

User that can read & write the class

However, when I try to query documents from this class, using this user in specific, I keep getting the error message "Permission denied for action find on class Person". This is how my code to login and query the class looks like:

const Person = Parse.Object.extend('Person')
Parse.Object.registerSubclass('Person', Person)

Parse.User.logIn('username', 'password').then(user => {
    console.log('E-mail: ' + user.getEmail())
    console.log('Created: ' + user.createdAt)
    console.log('Current: ' + user.isCurrent())
    console.log('Authenticated: ' + user.authenticated())

    const query = new Parse.Query(Person)
    query.equalTo('name', 'John')
    return query.find()
})

I included a bunch of console.log's to check what information about the user is being printed and I confirm that the login seems to complete successfully because the fields email and createdAt match the information that I see in the Parse Dashboard. However, the field authenticated and current both return false, but I don't know why. I was expecting them to return true.

This is the only place in the application that I try to login the Parse Server and perform an operation that is restricted to only one user. Any idea why I'm getting this "Permission denied for action find on class Person" error?

1

There are 1 best solutions below

0
Cash Johnson On

I guess that this is related to security. Generally Parse will not allow a user to get data about any other user, unless you do some actions - e.g. - allow it from the dashboard. But anyway I guess that you have to do it one by one.