-
-
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
Can no longer do setPassword() from cloud code with the master key #1087
Comments
How are you calling save? The right way would be, |
I get the error with the following test code, however I am now also getting a permission denied error for Parse.User.signUp which makes me wonder if there's some configuration problem with the schema or something. Logging in works.
|
what error?.. I think you should json encode the object in a response to a cloud function: Parse.Cloud.define('testSetPasswordForUser', function(request, response) {
var query = new Parse.Query("_User");
query.get(request.params.userId, { useMasterKey: true }).then((user) {
user.setPassword(request.params.newPassword);
return user.save(null, { useMasterKey: true });
}).then((user) => {
response.success(JSON.stringify(user));
}, (obj, error) => {
response.error(error.message);
});
}); ^ Your code updated with promises. |
This may be a separate issue :) But I'm trying to create a user to test the password setting in a clean way and this error is happening. I am on 2.1.6.
|
Take a look at the _SCHEMA collection, the row for the _User.. It's failing a class level permission, so tell me what is in the _metadata key of that object. |
|
Try adding |
Okay, that did work, and after creating one user I set it back the way it was and it seems happy. It also has fixed the original error with setting a user's password with the master key. Looking at the schema, it seems to have added these fields to the schema record for _User that weren't there from the initial migration:
I'm pretty sure I've run User.signUp a bunch in the past so I'm guessing those were implicit fields in the past and upgrading to 2.1.6 means they're now explicit in the schema? In any case, thanks for the help! |
Ok, glad it's working.. CLPs are still an area in progress. |
I think the actual fix here is if we are using the master Key canAddField (in DatabaseController) should always return true. I've created a PR #1294 As for the issue with the password field not being part of the _User object, Shouldn't we explicitly check the defaultColumns as well in Schema.js. |
We have an admin interface so CS can set passwords for users who are having trouble setting their own. Unfortunately I can no longer seem to set the password for a user from cloud code using the master key.
Environment Setup
Get a user from cloud code using Parse.Query(Parse.User).get(). ACL is set so that the user can read/write their own data and anyone in the Admin role can read it, but we require the master key to actually change another user's data.
Steps to reproduce
Call user.setPassword("some new password") and attempt to save with useMasterKey: true.
Logs/Trace
error: ParseError { code: 101, message: 'Permission denied for this action.' }
The text was updated successfully, but these errors were encountered: