Web Niraj
  • Facebook
  • Flickr
  • Github
  • Linkedin
  • Twitter
  • YouTube
Online portfolio, code examples and developer blog
  • About
  • Contact
  • Portfolio
  • WordPress
Search the site...
  • Home
  • Blog
  • Parse.com: Using DataTypes, Pointers and ACL in PHP and JavaScript

Parse.com: Using DataTypes, Pointers and ACL in PHP and JavaScript

0

Despite it’s short-comings, Parse.com is a very good cloud database solution for light-weight applications and even prototyping. Parse.com makes it easily for you to reference data from other table using Pointers (similar to joining in SQL) and lets you secure data using ACL on a row-by-row basis. One of the most common question I get with Parse is how to use Pointers and ACL – this tutorial answers both.

Pointers and DataTypes in PHP

If you’re using the Parse.com PHP SDK, using pointers is easy thanks to the dataType function. The dataType provides support for the various data-types supported by Parse, including date, pointers, bytes and geopoint. Creating a pointer to another table can be achieved like this:

The above example also include how to set ACL permissions. In the above code, we only allow read access to the User it belongs to. Public read access is disabled, and no one is allowed to write data.

Pointers and DataTypes in JavaScript

The below code achieves the same result as the PHP code above. The way pointers and dataTypes work in JavaScript are slightly different. The ACL code in JavaScript is very similar to the PHP version.

PHP DataType Examples

Here is an example of the various dataTypes the PHP SDK supports (note that there are a few more dataTypes that are supported):

JavaScript DataType Examples

Once again, I’ve included how to do the PHP examples above using JavaScript.

PHP ACL Examples

You can give read / write access to public (logged or anonymous) users, as well as specific users. There are several functions available to set read / write access, as shown in the code below:

JavaScript ACL Examples

The code below shows how to set ACL in JavaScript. It’s a copy of the permissions set in the PHP example above.


Have any questions, or stuck with data types or ACL? Tell us in the comments section below.

ACL, JavaScript, Parse, PHP, Tutorial

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

StackExchange / StackOverflow

profile for Niraj Shah on Stack Exchange, a network of free, community-driven Q&A sites

Support Me

Buy Me a Coffee

PSN Profile

Tags

ACL Amazon Web Services Android Android 4.4 KitKat Android 5.0 Lollipop Apache Backup Bash Bug Command Line Cordova cPanel / WHM Facebook Facebook Graph API Facebook PHP SDK 4.0 Facebook Social Plugins Fan Page Flash Geolocation Google Nexus 5 Hacking HTML5 Input Sanitization iOS JavaScript jQuery Laravel 5 Laravel 5.2 Linux Mac OS NodeJS Parse PDF PHP Plugin Portfolio Review Security Server SSH SSL Sysadmin Tutorial WordPress WordPress Plugins
© 2011-2025 Niraj Shah
  • Blog
  • Portfolio
  • WordPress
  • About Me
  • Contact Me
  • Privacy Policy
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Privacy Policy