Adds fix for issue affecting update with CLP (#5269)

* Adds fix for issue affecting update with CLP

* Disable single instance
This commit is contained in:
Florent Vilmart
2019-01-04 14:23:27 -05:00
committed by GitHub
parent 9f2fc88f0f
commit 46ac7e7f11
6 changed files with 22 additions and 23 deletions

View File

@@ -1141,7 +1141,6 @@ class DatabaseController {
distinct,
pipeline,
readPreference,
isWrite,
}: any = {}
): Promise<any> {
const isMaster = acl === undefined;
@@ -1217,7 +1216,7 @@ class DatabaseController {
);
}
if (!query) {
if (op == 'get') {
if (op === 'get') {
throw new Parse.Error(
Parse.Error.OBJECT_NOT_FOUND,
'Object not found.'
@@ -1227,7 +1226,7 @@ class DatabaseController {
}
}
if (!isMaster) {
if (isWrite) {
if (op === 'update' || op === 'delete') {
query = addWriteACL(query, aclGroup);
} else {
query = addReadACL(query, aclGroup);

View File

@@ -30,7 +30,6 @@ function RestQuery(
this.clientSDK = clientSDK;
this.response = null;
this.findOptions = {};
this.isWrite = false;
if (!this.auth.isMaster) {
if (this.className == '_Session') {
@@ -259,12 +258,6 @@ RestQuery.prototype.buildRestWhere = function() {
});
};
// Marks the query for a write attempt, so we read the proper ACL (write instead of read)
RestQuery.prototype.forWrite = function() {
this.isWrite = true;
return this;
};
// Uses the Auth object to get the list of roles, adds the user id
RestQuery.prototype.getUserAndRoleACL = function() {
if (this.auth.isMaster) {
@@ -647,9 +640,6 @@ RestQuery.prototype.runFind = function(options = {}) {
if (options.op) {
findOptions.op = options.op;
}
if (this.isWrite) {
findOptions.isWrite = true;
}
return this.config.database
.find(this.className, this.restWhere, findOptions)
.then(results => {

View File

@@ -112,7 +112,6 @@ function del(config, auth, className, objectId) {
const hasLiveQuery = checkLiveQuery(className, config);
if (hasTriggers || hasLiveQuery || className == '_Session') {
return new RestQuery(config, auth, className, { objectId })
.forWrite()
.execute({ op: 'delete' })
.then(response => {
if (response && response.results && response.results.length) {
@@ -224,9 +223,9 @@ function update(config, auth, className, restWhere, restObject, clientSDK) {
const hasLiveQuery = checkLiveQuery(className, config);
if (hasTriggers || hasLiveQuery) {
// Do not use find, as it runs the before finds
return new RestQuery(config, auth, className, restWhere)
.forWrite()
.execute();
return new RestQuery(config, auth, className, restWhere).execute({
op: 'update',
});
}
return Promise.resolve({});
})