acra-storage/validate_doc_update.js
littleguy77 c76c761950 Added customizations.
- Broadened package name for signature characterization
    (lump together multiple published versions)
- Added view by signature
- Set minimum version for receiving reports
- Changed minimum year to 2013 for reports per day
- Added git settings
2013-12-04 08:40:45 -05:00

13 lines
528 B
JavaScript

function(newDoc, oldDoc, userCtx) {
var MIN_APP_VERSION_CODE = 34;
if(userCtx.roles.indexOf("_admin") < 0 && userCtx.roles.indexOf("reporter") < 0 && userCtx.roles.indexOf("_writer") < 0) {
throw({"unauthorized": "You may only post reports with reporter, _admin or _writer role "});
}
if(newDoc.APP_VERSION_CODE && newDoc.APP_VERSION_CODE < MIN_APP_VERSION_CODE) {
throw({"forbidden": "Reports from application version code lesser than " + MIN_APP_VERSION_CODE + " are not allowed anymore."});
}
}