AnsweredAssumed Answered

Hiding the Create-Site link

Question asked by lgoldblatt on Dec 28, 2010
In Alfresco 3.4, you can easily limit who has access to create sites using the information in the wiki (http://wiki.alfresco.com/wiki/Site_Service).  However, the links are still visible.  If someone without access tries to create a site, you get a nasty java exception.  If you only hide the links, then someone can still go directly to the links to create the sites anyway. 

What we did was limit the creation to someone in the alfresco_administrators group AND make the links invisible.  We didn't try to use a different group name, because we used the "isAdmin" function to determine if the user could create a site.  You might be able to sub-divide the alfresco_administrator's group - if someone tries this, please post results. 

The instructions to hide the links have changed a little for version 3.4, so i tweaked an older post's instructions for 3.3.
I added the information on where to place extensions instead of just modifying what's in the share WEB-INF folders.. 

1. Change the access to create sites according to the alfresco wiki (http://wiki.alfresco.com/wiki/Site_Service) so that GROUP_ALFRESCO_Administrators has the right to create sites..  (we did find that you have to use the word "GROUP_" in this case, not just "Alfresco_Administrators".)

2. Create new folders for the extensions if you don't have them already.
     ..<Tomcat folder>\shared\classes\alfresco\web-extension\site-webscripts\org\alfresco\components\dashlets
     ..<Tomcat folder>\shared\classes\alfresco\web-extension\site-webscripts\org\alfresco\modules\header

3. Copy from the main alfresco folders to the corresponding extensions folders
      ..<Tomcat folder>\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\dashlets
             my-sites.get.html.ftl
             user-welcome.get.html.ftl
      ..<Tomcat folder>\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\modules\header
             sites.get.html.ftl

4. In   my-sites.get.html.ftl      make the following mods to put a condition around the class "Create-site-menuitem"

      <#if user.isAdmin>
      <ul class="create-site-menuitem">
         <li>
            <span><a href="#" onclick='Alfresco.util.ComponentManager.get("${id_js}").showCreateSite(); return false;'>${msg("label.create-site")}</a></span>
         </li>
      </ul>
      </#if>

5. in    user-welcome.get.html.ftl   we just removed the create site entry from the getting started dashlet and made the entry to customize dashboard the last entry. THen, delete lines containing class entry for createSite

      <div class="detail-list-item last-item">
         <h4 class="theme-color-2">${msg("header.customiseDashboard")}</h4>
         <div>${msg("text.customiseDashboard")}</div>
         <div><a href="${url.context}/page/customise-user-dashboard" class="theme-color-2">${msg("link.customiseDashboard")}</a></div>
      </div>

6. in sites.get.html.ftl make the following mods  to put a condition around the reference to the create site button

   <div class="toolbar flat-button">
      <span class="yui-button-align">
         <span class="first-child">
      <#if user.isAdmin>
            <a href="#" id="${args.htmlid}-createSite-button" class="theme-color-1">${msg("link.createSite")}</a>
      </#if>
          </span>

I hope these instructions are clear enough - they worked for us anyway

Outcomes