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

Missing ACL info in database object

Open mchun opened this issue 10 years ago • 5 comments

I used the following code on server side for saving object:

app.post('/',requireUser, function(req, res) {
    var post = new Post();
    post.set("Category",req.body.Category)
    var acl = new Parse.ACL();
    acl.setPublicReadAccess(true);
    acl.setRoleWriteAccess("admin", true);
    acl.setWriteAccess(req.user, true);
    post.setACL(acl);
    post.save(null,{sessionToken:req.user.sessionToken});
  });

And this is the data saved in MongoDB

{
    "_rperm": [
        "*"
    ],
    "_wperm": [
        "role:admin",
        "SPtdQePtm2"
    ],
}

Unlike previously, there is also acl related data saved in the object, i.e.

    "_acl": {
        "*": {
            "r": true
        },
        "SPtdQePtm2": {
            "w": true
        },
        "role:admin": {
            "w": true
        }
    },

And consequence and is that a bug? P.S. I am using parse-server 2.1.2

mchun avatar Feb 22 '16 04:02 mchun

Hello, I have a similar issue, when I use the code below in my xcode xwift project, in the mongolab part the objects are written as below, and the ACL settings in the parse dashboard are not changed.

  let acl = PFACL()
  acl.publicReadAccess = true
  acl.publicWriteAccess = false
  userSettingObj["ACL"] = acl

   "_rperm": [
      "*"
    ],

However when I make the changes from the dashboard of parse, the mongolab acl record is like:

"_acl": {
        "*": {
            "r": true
        },
    },

  "_rperm": [
      "*"
    ],

What may be the reason?

sanergulec avatar Feb 26 '16 12:02 sanergulec

Same issue here

mtrezza avatar Feb 29 '16 14:02 mtrezza

ACL are transformed when saved to mongodb for performance optimization reasons. Do you have problem with objects that should not be read?

flovilmart avatar Mar 07 '16 15:03 flovilmart

Hi @gfosco Is this issue resolved? We are still seeing the same issue in 2.2.4.

michaelfy avatar Apr 04 '16 04:04 michaelfy

I guess it is related to #1317 , the compatibility between self hosted parse and parse.com

mchun avatar Apr 09 '16 07:04 mchun