sunset.js revision 962eb0542c63ff26b7c13d2058a9f53349d48d35
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel/*global input, objectID */
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel(function () {
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel // Create a change patch
962eb0542c63ff26b7c13d2058a9f53349d48d35huck.elliott var patch = [{ "operation" : "replace", "field" : "active", "value" : false },{ "operation" : "replace", "field" : "accountStatus", "value" : "inactive" }];
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel logger.debug("Performing Sunset Task on {} ({})", input.email, objectID);
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel // Perform update via patch so that we can do so regardless of revision change
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel // NOTE: If we were to use update and the object had been modified during script execution
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel // update would fail due to conflicting revision numbers
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel // Update method:
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel // input['active'] = false;
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel // openidm.update(objectID, input['_rev'], input);
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel return true; // return true to indicate successful completion