Skip to content

Instantly share code, notes, and snippets.

@AutomatedTester
Created March 14, 2012 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AutomatedTester/2036614 to your computer and use it in GitHub Desktop.
Save AutomatedTester/2036614 to your computer and use it in GitHub Desktop.
diff --git a/dashboard.js b/dashboard.js
index 3d2b04c..5c07701 100644
--- a/dashboard.js
+++ b/dashboard.js
@@ -11,6 +11,23 @@ ddoc = {
]
};
+ddoc.validate_doc_update = function(newDoc, oldDoc, userCtx){
+ if (newDoc._deleted === true && userCtx.roles.indexOf('_admin') !== -1) ) {
+ throw ({ forbidden : "Only an admin is allowed to delete data"});
+ }
+
+ var require = function(field) {
+ if (!newDoc[field]) throw ({ forbidden : "This document requires the field " + field });
+ }
+
+ require("time_start");
+ require("time_end");
+ require("system_info");
+ require("time_end");
+ require("tests_passed");
+ require("tests_failed");
+ require("tests_skipped");
+}
var functionalReportsMap = function(doc) {
const REPORT_TYPES = [
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment