AnsweredAssumed Answered

How do apply auto security on folders

Question asked by skorde on Jun 29, 2010
Java Script :>>

// log the docs that currently contain the word 'Alfresco' to a log file
var logFile = space.childByNamePath("permision log.txt");
if (logFile == null)
{
   logFile = space.createFile("permision log.txt");
}
if (logFile != null)
{
   // execute a saved lucene search across the repo for the folders that you want to apply security
   var nodeRef = "workspace://SpacesStore/"+"f96507c7-94f6-464b-b7ea-681e66ccb5a6";
   var folders = search.savedSearch(nodeRef );
   var log = "";
   for (var i=0; i<folders.length; i++)
   {
    log += "Name: " + folders[i].name + "\tPath: " + folders[i].displayPath + "\r\n";
    var folder= folders[i];    
    if (folder!= null)
   {
   folder.setPermission("Coordinator","GROUP_Advisory")
   folder.setInheritsPermissions(false)
   }
   }
   logFile.content += log;
}

Outcomes