cancel
Showing results for 
Search instead for 
Did you mean: 

Making Alfresco Admins Managers of All Sites in Share

benclayton
Champ in-the-making
Champ in-the-making
How can I make it so that any site created makes users in the ALFRESCO_ADMINISTRATORS group automatically managers?
1 REPLY 1

vamirr
Champ on-the-rise
Champ on-the-rise
Two steps,    create a script with the content below,    create a rule to run the script when a new site is created.


In Alfresco Explorer:

Navigate to Company Home > Data Dictionary > Scripts
- Create Content
    - addAdminOnSiteCreate.js (name it whatever you want)
    - put the script below into the content
    - Content Type -> plain text

Navigate to Company Home > Sites
- Click More Actions on the Sites page
- Manage Content Rules
- Create Rule
    - All Items
- Select Action
   - Execute Script
      - addAdminOnSiteCreate.js  (or whatever you called it)
- Type Items are created or enter this folder
-Title OnCreate add Admin Group  (or whatever you want)



Script to do what you want:


function processCommand(){
   try{
   var siteShortName = document.properties["cm:name"];      
   var newSite = siteService.getSite(siteShortName);
   var authorityName = "GROUP_ALFRESCO_ADMINISTRATORS";
   var role = "SiteManager";

   if(newSite)
      newSite .setMembership(authorityName, role);
   }catch(err){logger.log(err);}
}

processCommand();