Skip to content

Cannot set ACL from JSON #2096

Closed
Closed
@dplewis

Description

@dplewis

New Issue Checklist

Issue Description

Saving ACL from JSON throws ACL must be a Parse.ACL error. The validation on ACL prevents the json from properly encoding. This may also fix the issue #2028

Steps to reproduce

it('can set ACL from json', async () => {
    Parse.User.enableUnsafeCurrentUser();
    const user = new Parse.User();
    const object = new TestObject();
    user.set('username', 'torn');
    user.set('password', 'acl');
    await user.signUp();
    const acl = new Parse.ACL(user);
    object.setACL(acl);
    const json = object.toJSON();
    await object.save(json); // This breaks ACL must be a Parse.ACL.
    assert.equal(acl.equals(object.getACL()), true);
 });

This error also happens when on object.set({ ACL: acl.toJSON() });

Actual Outcome

Throws error

Expected Outcome

Should save object properly

Environment

Server

  • Parse Server version: 6.0.0
  • Operating system: MacOS
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.4
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • Parse JS SDK version: 4.3.1

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions