public function testAddUserAfterFetch() { $user = new ParseUser(); $user->setUsername('bob'); $user->setPassword('barker'); $user->signUp(); $role = ParseRole::createRole('MyRole', ParseACL::createACLWithUser($user)); $role->save(); $query = ParseRole::query(); $roleAgain = $query->get($role->getObjectId()); $roleAgain->getUsers()->add($user); $roleAgain->save(); }
public function testACLModifyingAfterLoad() { $user = new ParseUser(); $user->setUsername('alice'); $user->setPassword('wonderland'); $user->signUp(); $object = ParseObject::create('Object'); $acl = ParseACL::createACLWithUser($user); $object->setACL($acl); $object->save(); $this->assertTrue($object->getACL()->getUserReadAccess($user)); $this->assertTrue($object->getACL()->getUserWriteAccess($user)); $this->assertFalse($object->getACL()->getPublicReadAccess()); $this->assertFalse($object->getACL()->getPublicWriteAccess()); $query = new ParseQuery('Object'); $objectAgain = $query->get($object->getObjectId()); $objectAgain->getACL()->setPublicReadAccess(true); $this->assertTrue($objectAgain->getACL()->getUserReadAccess($user)); $this->assertTrue($objectAgain->getACL()->getUserWriteAccess($user)); $this->assertTrue($objectAgain->getACL()->getPublicReadAccess()); $this->assertFalse($objectAgain->getACL()->getPublicWriteAccess()); }