-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added req.auth.user to parse cloud functions #172
Conversation
I need this update as I too have the same problem my cloud functions do not get a user - How can i add this to my local version - it seems the library is not installed as I would expect - where are the files in the demo app. |
@xwizi you could clone my repo and then use
|
@@ -13,7 +13,8 @@ function handleCloudFunction(req) { | |||
return new Promise(function (resolve, reject) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the TODO from line 11?
@gfosco updated |
@taylorstine Gotcha I actually tried modifying my local copy, not so smart :-( - i'll try as you say hopefully that will fix my issues |
@taylorstine saying permission denied public key - git clone git@github.com:taylorstine/parse-server.git Please make sure you have the correct access rights |
@taylorstine : Ignore that |
@xwizi 😜 |
Added req.auth.user to parse cloud functions
👍 |
@gfosco @taylorstine Looks like this is now committed thanks for everyone's help! |
@taylorstine is |
@natanrolnik That's actually my bad 😞 , I forgot that there is a |
@taylorstine thanks for the answer. Ok - so is there any changes I should do on my server initialization, or should I wait for #209 to be merged? |
@natanrolnik I can't be sure without seeing your code, but I'm assuming that you won't need any changes to your server initialization. You can always pull down my branch and test it with your server. I was able to reproduce your issue if I used a master key. |
Updated mongodb-core to 2.1.10 NODE-981 delegate auth to replset/mongos if inTopology is set. NODE-978 Wrap connection.end in try/catch for node 0.10.x issue causing exceptions to be thrown, Also surfaced getConnection for mongos and replset. Remove dynamic require (Issue parse-community#175, https://github.com/tellnes). NODE-696 Handle interrupted error for createIndexes. Fixed isse when user is executing find command using Server.command and it get interpreted as a wire protcol message, parse-community#172. NODE-966 promoteValues not being promoted correctly to getMore. Merged in fix for flushing out monitoring operations. NODE-983 Add cursorId to aggregate and listCollections commands (Issue, parse-community#1510). Mark group and profilingInfo as deprecated methods NODE-956 DOCS Examples. Update readable-stream to version 2.2.7. NODE-978 Added test case to uncover connection.end issue for node 0.10.x. NODE-972 Fix(db): don't remove database name if collectionName == dbName (Issue, parse-community#1502) Fixed merging of writeConcerns on db.collection method. NODE-970 mix in readPreference for strict mode listCollections callback. NODE-966 added testcase for promoteValues being applied to getMore commands. NODE-962 Merge in ignoreUndefined from collection level for find/findOne. Remove multi option from updateMany tests/docs (Issue parse-community#1499, https://github.com/spratt). NODE-963 Correctly handle cursor.count when using APM.
Updated mongodb-core to 2.1.10 NODE-981 delegate auth to replset/mongos if inTopology is set. NODE-978 Wrap connection.end in try/catch for node 0.10.x issue causing exceptions to be thrown, Also surfaced getConnection for mongos and replset. Remove dynamic require (Issue #175, https://github.com/tellnes). NODE-696 Handle interrupted error for createIndexes. Fixed isse when user is executing find command using Server.command and it get interpreted as a wire protcol message, #172. NODE-966 promoteValues not being promoted correctly to getMore. Merged in fix for flushing out monitoring operations. NODE-983 Add cursorId to aggregate and listCollections commands (Issue, #1510). Mark group and profilingInfo as deprecated methods NODE-956 DOCS Examples. Update readable-stream to version 2.2.7. NODE-978 Added test case to uncover connection.end issue for node 0.10.x. NODE-972 Fix(db): don't remove database name if collectionName == dbName (Issue, #1502) Fixed merging of writeConcerns on db.collection method. NODE-970 mix in readPreference for strict mode listCollections callback. NODE-966 added testcase for promoteValues being applied to getMore commands. NODE-962 Merge in ignoreUndefined from collection level for find/findOne. Remove multi option from updateMany tests/docs (Issue #1499, https://github.com/spratt). NODE-963 Correctly handle cursor.count when using APM.
According to the TODO here the cloud code functions are missing the
req.user
parameter. Here, I'm adding the parameter based on thereq.auth
. Note that in order to get this to work, I had to overwrite the session token returned from the user query with the one provided inreq.info
. Please scrutnize this closely, I have no idea why the_User
object is even stored with a session token. When I try to use the session token returned from the user query, my cloud functions return empty results because I have ACL permissions set up. I did delete some of my session tokens earlier, so that might have something to do with it.If this update is incorrect, maybe an error should be thrown if there is an invalid session token. If the
_User
object is stored with a session token in order to provide some kind of master validation for any requests that user might make, and that session token was removed from the database of session tokens, then there is no error thrown, and to the user it just looks like no results are showing from their query.Please advise, again I do not fully know the implications of doing this.