feat: Job Scheduling (#3927)

* Adds back _JobSchedule as volatile class

* wip

* Restores jobs endpoints for creation, update and deletion

* Adds tests

* Fixes postgres tests

* Enforce jobName exists before creating a schedule
This commit is contained in:
Florent Vilmart
2017-06-14 13:07:00 -04:00
committed by GitHub
parent 9256b2d7e6
commit f0949a1310
5 changed files with 284 additions and 15 deletions

View File

@@ -134,7 +134,8 @@ function update(config, auth, className, restWhere, restObject, clientSDK) {
});
}
// Disallowing access to the _Role collection except by master key
const classesWithMasterOnlyAccess = ['_JobStatus', '_PushStatus', '_Hooks', '_GlobalConfig', '_JobSchedule'];
// Disallowing access to the _Role collection except by master key
function enforceRoleSecurity(method, className, auth) {
if (className === '_Installation' && !auth.isMaster) {
if (method === 'delete' || method === 'find') {
@@ -144,8 +145,7 @@ function enforceRoleSecurity(method, className, auth) {
}
//all volatileClasses are masterKey only
const volatileClasses = ['_JobStatus', '_PushStatus', '_Hooks', '_GlobalConfig'];
if(volatileClasses.includes(className) && !auth.isMaster){
if(classesWithMasterOnlyAccess.includes(className) && !auth.isMaster){
const error = `Clients aren't allowed to perform the ${method} operation on the ${className} collection.`
throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, error);
}