Jan 132011
 

Today I was asked if you could prevent users from removing the “Versionable” aspect in Alfresco Share.  In short, yes you can, but I didn’t find anything that specifically documents how to do it, so here it is!

In your extension directory, your custom Share configuration typically located at <Alfresco>/tomcat/shared/classes/alfresco/web-extension/share-custom-config.xml should be modified as follows:

   <!-- Document Library config section -->
   <config evaluator="string-compare" condition="DocumentLibrary" replace="true">

      <tree>
         <!--
            Whether the folder Tree component should enumerate child folders or not.
            This is a relatively expensive operation, so should be set to "false" for Repositories with broad folder structures.
         -->
         <evaluate-child-folders>false</evaluate-child-folders>

         <!--
            Optionally limit the number of folders shown in treeview throughout Share.
         -->
         <maximum-folder-count>-1</maximum-folder-count>
      </tree>

      <!--
         Used by the "Manage Aspects" action

         For custom aspects, remember to also add the relevant i18n string(s)
            cm_myaspect=My Aspect
      -->
      <aspects>
         <!-- Aspects that a user can see -->
         <visible>
            <aspect name="cm:generalclassifiable" />
            <aspect name="cm:complianceable" />
            <aspect name="cm:dublincore" />
            <aspect name="cm:effectivity" />
            <aspect name="cm:summarizable" />
            <aspect name="cm:templatable" />
            <aspect name="cm:emailed" />
            <aspect name="emailserver:aliasable" />
            <aspect name="cm:taggable" />
            <aspect name="app:inlineeditable" />
            <aspect name="cm:versionable" />
         </visible>

         <!-- Aspects that a user can add. Same as "visible" if left empty -->
         <addable>
            <aspect name="cm:generalclassifiable" />
            <aspect name="cm:complianceable" />
            <aspect name="cm:dublincore" />
            <aspect name="cm:effectivity" />
            <aspect name="cm:summarizable" />
            <aspect name="cm:templatable" />
            <aspect name="cm:emailed" />
            <aspect name="emailserver:aliasable" />
            <aspect name="cm:taggable" />
            <aspect name="app:inlineeditable" />
            <aspect name="cm:versionable" />

         </addable>

         <!-- Aspects that a user can remove. Same as "visible" if left empty -->
         <removeable>
            <aspect name="cm:generalclassifiable" />
            <aspect name="cm:complianceable" />
            <aspect name="cm:dublincore" />
            <aspect name="cm:effectivity" />
            <aspect name="cm:summarizable" />
            <aspect name="cm:templatable" />
            <aspect name="cm:emailed" />
            <aspect name="emailserver:aliasable" />
            <aspect name="cm:taggable" />
            <aspect name="app:inlineeditable" />
         </removeable>
      </aspects>
</config>

Note that in the configuration above, the versionable aspect is in the “visible” and “addable” lists, but not in the “removable” list, while everything else is in all three lists.

This is an example of this configuration in action:

manageaspects

Note that this is applicable for any aspect in Alfresco, including custom aspects that are defined in your own content models.

Feel free to download Alfresco and try it out for yourself.

Sorry, the comment form is closed at this time.