Skip to content

Commit

Permalink
Remove useless masterKey validation in PushController.sendPush.
Browse files Browse the repository at this point in the history
  • Loading branch information
nlutsenko committed Mar 7, 2016
1 parent 646da50 commit 3606a25
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/Controllers/PushController.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,13 @@ export class PushController extends AdaptableController {
}
}
}

/**
* Check whether the api call has master key or not.
* @param {Object} request A request object
*/
static validateMasterKey(auth = {}) {
if (!auth.isMaster) {
throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED,
'Master key is invalid, you should only use master key to send push');
}
}

sendPush(body = {}, where = {}, config, auth) {
var pushAdapter = this.adapter;
if (!pushAdapter) {
throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED,
'Push adapter is not available');
}
PushController.validateMasterKey(auth);
PushController.validatePushType(where, pushAdapter.getValidPushTypes());
// Replace the expiration_time with a valid Unix epoch milliseconds time
body['expiration_time'] = PushController.getExpirationTime(body);
Expand Down Expand Up @@ -140,6 +128,6 @@ export class PushController extends AdaptableController {
expectedAdapterType() {
return PushAdapter;
}
};
}

export default PushController;

0 comments on commit 3606a25

Please sign in to comment.