Not able to create Autometic Groups by Site manager
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2016 04:44 AM
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 ;
}
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 ;
}
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2016 07:57 AM
It is a permission problem.
Just like you said, "but when i am executing that js while folder is created by admin, then it executes properly, and also creates group automatically."
The site manager is not an Alfresco administrator user, and because of that, he can't create new groups.
Just like you said, "but when i am executing that js while folder is created by admin, then it executes properly, and also creates group automatically."
The site manager is not an Alfresco administrator user, and because of that, he can't create new groups.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2016 06:21 AM
Hi douglascrp,
actually it was our requirement, and we have to create those groups by site manager only.
but we achieved it through java class.
now its working fine,
and now those groups are also created by site manager…..

Thanks
actually it was our requirement, and we have to create those groups by site manager only.
but we achieved it through java class.
now its working fine,
and now those groups are also created by site manager…..


Thanks

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2016 06:50 AM
Have you used AuthenticationUtil.RunAs or how you've achieved it in Java? Just share some of the code snippets, it may help someone.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2016 07:20 AM
We wrote one evaluator for it, created jar file via eclipse. and using that jar file we executed js by site manager with admin permissions.
now its fine..
if any one need more help then they can contact me.
i will provide you the source code and proper steps to do this.
Thanks,
Deepak
now its fine..
if any one need more help then they can contact me.
i will provide you the source code and proper steps to do this.
Thanks,
Deepak
