Skip to content

Instantly share code, notes, and snippets.

What would you like to do? JavaScript SDK - Using Pointers and ACL
// new Profile object
var Profile = Parse.Object.extend("Profile");
var profile = new Profile();
// set DOB as date - needs to be ISO format
var dob = new Date("1985-01-01");
profile.set( 'dob', { "__type": "Date", "iso": dob.toISOString() } );
// bio string data
profile.set( 'bio', 'I am a PHP developer' );
// pointer to User table (parse Classes should have _ prefix.)
profile.set( "userId", { "__type": "Pointer", "className": "_User", "objectId": Parse.User.current().id } );
// create ACL
var acl = new Parse.ACL();
// public cannot read data
// user can read data
acl.setReadAccess( Parse.User.current(), true );
// save ACL to object
profile.setACL( acl );, {
success: function(item) {
// success callback
error: function(item, error) {
// error callback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment