Alfresco and ECM

Disable a page in Alfresco Share

jun 23 2011

Categories : Tips and Tricks, Tutorials

You have successfully installed Alfresco Share and now you want to expose Share on internet so that you can collaborate with external users. But you do not want them to access certain pages, like the repository page, for whatever reason you have. First thing you do is to remove the button or menu from the toolbar, having looked at the instructions found on the wiki about Share Header.

Now that removes any links to the page, but as the experienced Alfresco user you are, you know that you still can access the page typing the complete url to the page, for repository page it is /share/page/repository. And this is something you wanted to disable.

It is actually very easy to, the url will still be available, but not displaying any content besides the navigation bar.

Share disable page

Start with adding in


these folders and subfolders


What you want to do is find the definition file of the page you want to disable, and copy it to site-data/pages. For the page used in this example, repository, it is tomcat/webapps/share/WEB-INF/classes/alfresco/site-data/pages/repository.xm
After copying, edit this page to be

<?xml version='1.0' encoding='UTF-8'?>
   <title>Repository Browser</title>
   <description>Browse content across the whole Repository</description>

The important change here is <template-instance>disabled</template-instance>, we are telling this page to use a new template, that we now have to create.
Create the file site-data/template-instances/disabled.xml with content

<?xml version='1.0' encoding='UTF-8'?>
<?xml version='1.0' encoding='UTF-8'?>

and the the actual template file site-data/templates/disabled.ftl with content

<#include "/org/alfresco/include/alfresco-template.ftl" />
<@templateHeader />

   <div id="alf-hd">
      <@region id="header" scope="global" protected=true />
This page is not available.

   <div id="alf-ft">
      <@region id="footer" scope="global" protected=true />

You can of course add what ever message you like.
Then refresh your webs-scripts or restart your server, and your repository page is disabled.
For any additional page you want to disable, you can just reuse the disabled template. All you have to do is the first step and copy the page definition file, and change it to reference your new template. To know what file to copy, navigate to the page you want to disable, in the url what you find after the /page/ is usually the name of the page definition file with an xml extension.

And of course this can be done even more advanced, like adding response status code 404, add I18N support for the message, or including component webscripts. But this will get you started.