Skip to content

Instantly share code, notes, and snippets.

@AFaust
AFaust / clearUserHomesBatch.js
Last active February 6, 2017 19:05
Example: JavaScript batch process to clear user homes using the Alfresco Enhanced Script Environment and its batch processing capabilities. See https://github.com/AFaust/alfresco-enhanced-script-environment and https://github.com/AFaust/alfresco-enhanced-script-environment/wiki/Batch-Processing
// character codes for 'a' to 'z'
var charCode = 97, max = 122;
// userProvider provides batches of users based on first name initial character
function userProvider()
{
var results = [], initial;
while(results.length === 0 && charCode <= max)
{
initial = String.fromCharCode(charCode++);
@AFaust
AFaust / share-header.get.js
Last active December 22, 2015 07:49
This script removes some Share header items in a share-header.get.js customization. Currently there does not appear to be a utility to remove widgets from the new JS widget model, so this is what got the job done for me...
var widget, widgetsToRemove = [ "HEADER_SHARED_FILES", "HEADER_MY_FILES", "HEADER_PEOPLE", "HEADER_TASKS", "HEADER_REPOSITORY",
"HEADER_SEARCH" ], idx, max;
for (idx = 0, max = widgetsToRemove.length; idx < max; idx++)
{
findAndRemoveIn(model.jsonModel.widgets, null, null, widgetsToRemove[idx]);
}
function findAndRemoveIn(obj, arrContext, arrIdx, id)
{