Skip to content

Commit

Permalink
Merge pull request #172 from taylorstine/cloud_shim
Browse files Browse the repository at this point in the history
Added req.auth.user to parse cloud functions
  • Loading branch information
gfosco committed Feb 2, 2016
2 parents 15edb0c + 35b6b16 commit a78adfe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ var getAuthForSessionToken = function(config, sessionToken) {
var obj = results[0]['user'];
delete obj.password;
obj['className'] = '_User';
obj['sessionToken'] = sessionToken;
var userObject = Parse.Object.fromJSON(obj);
cache.setUser(sessionToken, userObject);
return new Auth(config, false, userObject);
Expand Down
4 changes: 2 additions & 2 deletions functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ var express = require('express'),
var router = new PromiseRouter();

function handleCloudFunction(req) {
// TODO: set user from req.auth
if (Parse.Cloud.Functions[req.params.functionName]) {
return new Promise(function (resolve, reject) {
var response = createResponseObject(resolve, reject);
var request = {
params: req.body || {}
params: req.body || {},
user: req.auth && req.auth.user || {}
};
Parse.Cloud.Functions[req.params.functionName](request, response);
});
Expand Down

0 comments on commit a78adfe

Please sign in to comment.