Skip to content

Instantly share code, notes, and snippets.

View whoisandy's full-sized avatar

Anand Annavajhala whoisandy

View GitHub Profile
@pulkitsinghal
pulkitsinghal / sample.js
Created May 3, 2014 00:27
Parse Cloud Code for checking if a user has the required role
Parse.Cloud.define('isAdmin', function(request, response){
if(!Parse.User.current()){
response.error('Request did not have an authenticated user attached with it');
}
else {
userHasRole(request.params.parseSessionToken, 'super') // ex: check if user has "super" role
.then(function(hasRole){
if(hasRole){
response.success({super: true});
}else{