sunset.js revision 756e9b7d2193d27f37121f3ecb1f4ee53b710859
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel/*global input, objectID */
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel(function () {
759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5dJake Feasel // Create a change patch
756e9b7d2193d27f37121f3ecb1f4ee53b710859Jon Branch var patch = [{ "operation" : "replace", "field" : "/active", "value" : false },{ "operation" : "replace", "field" : "/accountStatus", "value" : "inactive" }];
b3e8cebb89cdfaf0d5999ab53d41c61465e3f242Laurent Bristiel logger.debug("Performing Sunset Task on {} ({})", input.mail, 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