0
votes

Parse server version: 2.1.14 // Parse dashboard version 1.0.14

I'm trying to set up some ACL. For my Gameclass, I have set up CLP like so:enter image description here

And in cloud code in before save, I'm setting ACL like this :

// Set ACL
var player1 = game.get('player1')
var player2 = game.get('player2')
var acl = new Parse.ACL()
acl.setReadAccess(player1.id, true)
acl.setReadAccess(player2.id, true)
acl.setWriteAccess(player1.id, true)
acl.setWriteAccess(player2.id, true)
game.setACL(all)

This code works as ACL gets properly updated in db. But when I'm trying to read a game with player1 in my iOS app, I get :

[Error]: Object not found for update. (Code: 101, Version: 1.13.0)

What am I missing here ? My goal is that only player 1 and 2 can read or write on a game. And no one can delete or add field.

PS : I have tried pointer permission on player 1 and 2 instead of ACLs but I get the same error.

1
You tag the question with Swift but I don't see a single line of Swift code here - Code Different
OK it was just iOS related. I removed it. Thanks - Ambroise Collon
Looks like you have a typo in your last line of code. Instead of game.setACL(all) it should be game.setACL(acl) (acl vs all). - daniels

1 Answers

0
votes

Try using CLPs instead of ACLs.

Step 1: add 2 pointer fields to the game object called player1 and player2.

Step 1

Step 2: in the security section of the dashboard where it says "Role, User, or Pointer" type "player1" and "player2" then you can give the players permission and uncheck the public options. Here is a screenshot.

Step 2