Fix error when updating installation with useMasterKey (#2888)

* Add failing test for updating installations with masterKey

* Prevent auth.installationId from being used when using masterKey

This allows masterKey to update any installation object
Fixes ParsePlatform/parse-server##2887
This commit is contained in:
Jeremy Louie
2016-10-19 15:06:19 -04:00
committed by Florent Vilmart
parent 305b037176
commit a6a6f7ff60
2 changed files with 29 additions and 2 deletions

View File

@@ -578,8 +578,12 @@ RestWrite.prototype.handleInstallation = function() {
this.data.installationId = this.data.installationId.toLowerCase();
}
// If data.installationId is not set, we can lookup in the auth
let installationId = this.data.installationId || this.auth.installationId;
let installationId = this.data.installationId;
// If data.installationId is not set and we're not master, we can lookup in auth
if (!installationId && !this.auth.isMaster) {
installationId = this.auth.installationId;
}
if (installationId) {
installationId = installationId.toLowerCase();