Created
September 11, 2013 12:50
-
-
Save loftux/6523137 to your computer and use it in GitHub Desktop.
Script to reset user dashboard in Alfresco. Actually two scripts in same Gist. To be used with the Alfresco Javascript console//
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//***** Script variant one, fore one user ******** | |
var userid = "userid01"; | |
var searchobj = { | |
query:'PATH:"/app:company_home/st:sites/cm:surf-config/cm:components/*" AND @cm\:name:"*'+userid+'*"', | |
language: 'fts-alfresco' | |
}; | |
var nodes = search.query(searchobj); | |
for(i=0, ii=nodes.length;i<ii;i++){ | |
//use only the dashboard ones | |
if(nodes[i].name.indexOf('dashboard')>-1){ | |
print(nodes[i].name); | |
//nodes[i].remove(); | |
} | |
} | |
print('***') | |
searchobj.query = 'PATH:"/app:company_home/st:sites/cm:surf-config/cm:pages/cm:user/cm:'+userid+'/*"'; | |
nodes = search.query(searchobj); | |
for(i=0, ii=nodes.length;i<ii;i++){ | |
//use only the dashboard ones | |
if(nodes[i].name.indexOf('dashboard')>-1){ | |
print(nodes[i].name); | |
//nodes[i].remove(); | |
} | |
} | |
print(new Date().toString()); | |
//***** Script variant two, fore all users dashboard ******** | |
print('Deleting all user welcome dashboards'); | |
var searchobj = { | |
query:'PATH:"/app:company_home/st:sites/cm:surf-config/cm:components/*" AND @cm\:name:"*dashboard*"', | |
language: 'fts-alfresco' | |
}; | |
var nodes = search.query(searchobj); | |
for(i=0, ii=nodes.length;i<ii;i++){ | |
//use only the dashboard ones | |
if(nodes[i].name.indexOf('user')>-1 && nodes[i].name.indexOf('width')>-1){ | |
print(nodes[i].name); | |
//nodes[i].remove(); | |
} | |
} | |
print(new Date().toString()); | |
print('Finished'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nodes[i].remove(); is commented out above, this way you can do a dry run. Remove comment to actually remove dashboard components.