AnsweredAssumed Answered

Not able to create Autometic Groups by Site manager

Question asked by deeps on Feb 1, 2016
Latest reply on Feb 3, 2016 by deeps
Hi all,

I have written one js for creating automatic groups in alfresco. and i am executing that js while Folder or market is created by site manager. and in this case its not creating group.

but when i am executing that js while folder is created by admin,  then it executes properly, and also creates group automatically.

So whats wrong with site manager???
i have given coordinator rights for site manager, and its highest right.

can any one help me??
i am using alfresco "5.0 d community"

please reply.

Thanks in advance :(





I am using below code in js-

   var logFile2 = space.childByNamePath("logs.txt");
   if (logFile2 == null) {
      logFile2 = space.createFile("logs.txt");
   }
    logFile2.content = "Script execution Started\n";
   logFile2.content+="Folder Name="+space.properties.name;
   
   var nodes=space.childFileFolders();
   try{
      for(var n in nodes){   
      var nodeReference=nodes[n].nodeRef;
         //logFile2.content+="\n\n"+n+" "+nodes[n].name+" "+nodeReference;
         var foundNode = search.findNode(nodeReference);
         try{
            if(foundNode.isContainer){
               logFile2.content+="\n\n"+n+" "+nodes[n].name+" "+nodeReference;
               var parentGroup = groups.getGroup("grp_pf_all_users");
               var grp_name="grp_pf_"+foundNode.properties.name;
               var readGroup = groups.getGroup(grp_name.toLowerCase()+"_read");  //groups.getGroup returns ScriptGroup 
               if(readGroup==null){
                  //readGroup= parentGroup.createGroup(grp_name.toLowerCase()+"_read",grp_name.toLowerCase()+"_read");
               }
               var writeGroup = groups.getGroup(grp_name.toLowerCase()+"_write"); //groups.getGroup returns ScriptGroup 
               if(writeGroup==null){
                  //writeGroup=parentGroup.createGroup(grp_name.toLowerCase()+"_write",grp_name.toLowerCase()+"_write");
               }
            }
         }catch(err){
            logFile2.content+= "\nError to add user read group  "+err ;
         }
      }
   }catch(err){
      logFile2.content+= "\nError to add user read group  "+err ;
   }

Outcomes