cancel
Showing results for 
Search instead for 
Did you mean: 

Use Alfresco folder rules to perform admin tasks

arjunpatil
Champ in-the-making
Champ in-the-making
Hi all,

I have written one js for creating automatic groups in alfresco. and i am executing that js while Folder 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 Smiley Sad





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 ;
   }
1 REPLY 1

muralidharand
Star Contributor
Star Contributor
Site Manger will not have permission to create groups and admin permission/ right required to create groups.