Skip to content

CLP assertion fails when class is included in a query #2246

Closed
@tzabian

Description

@tzabian

Describe your issue in as much detail as possible.

_User class has public read/write CLP; UserProfile class has read/write CLP

As a user, when running a GET on a _User object which contains a pointer to a UserProfile object, the result returns a non-existent value for UserProfile.

When running the same using MasterKey, result comes back as expected. When changing CLPs on UserProfile to public read/write, things work as expected.

This scenario works in our current implementation on Parse.com.

Steps to reproduce

Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.

  1. Create a UserProfile class that has a field which is a pointer to _User
  2. Add a CLP on this class with only read/write permissions (no Public permissions)
  3. Create a pointer field in _User called which which points to UserProfile (hence creating a two-way relationship)
  4. Create an object in both _User and UserProfile which point to each other via the and fields respectively.
  5. Query the _User object as the user themself and include=userProfile

Expected Results

You would expect something like the following

{
    "createdAt": "2015-10-05T07:55:55.124Z",
    "email": "xxx@yyy.com",
    "name": "Users Name ",
    "objectId": "ungxXVTqP4",
    "sessionToken": "r:xxxxxxxxxxxx",
    "updatedAt": "2015-10-05T07:55:56.791Z",
    "userProfile": {
        "__type": "Object",
        "className": "UserProfile",
        "createdAt": "2015-10-05T07:55:55.679Z",
        "objectId": "DbGP97sT7j",
        "updatedAt": "2015-10-05T07:55:55.679Z",
        "user": {
            "__type": "Pointer",
            "className": "_User",
            "objectId": "ungxXVTqP4"
        }
    },
    "username": "user@name.com"
}

Actual Outcome

{
    "createdAt": "2015-10-05T07:55:55.124Z",
    "email": "xxx@yyy.com",
    "name": "Users Name ",
    "objectId": "ungxXVTqP4",
    "sessionToken": "r:xxxxxxxxxxxx",
    "updatedAt": "2015-10-05T07:55:56.791Z",
    "username": "user@name.com"
}

Environment Setup

  • Server
    • parse-server version: 2.2.15
    • Operating System: Mac OSX 10.11.5 (local NodeJS)
    • Hardware: MacBook Pro (Retina, 13-inch, Late 2013)
    • Localhost or remote server? Localhost
  • Database
    • MongoDB version: 3.2.1
    • Storage engine: wiredTiger
    • Hardware: Local - same as above
    • Localhost or remote server? Local

Logs/Trace

You can turn on additional logging by configuring VERBOSE=1 in your environment.

The trace is the Actual Outcome section above with some obfuscation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions