cancel
Showing results for 
Search instead for 
Did you mean: 

Disable Download Action in Alfresco Share 3.3g

cfpatel
Champ in-the-making
Champ in-the-making
Dear Friends ,

           I am new to Alfresco using Community Edition 3.3 g .Can any one help me out to disable the download action option while previewing the file from alfresco share. Also give some useful tips to use WebDav with alfresco .

Its Urgent,

Thank You In Advance,
11 REPLIES 11

brauliotrujillo
Champ in-the-making
Champ in-the-making
i don´t know if you still need to disable the download action or if you already found a solution, i had the same issue and after looking everywhere and not finding nothing i decided to give it a try myself and this is what i came up with,

i realized that when you login as admin there is some admin specific actions that no other user can see so i thought there must be a way to do the same for the download action, so whar i did was to look in the xml file containing that behavior, which is "document-actions.get.config.xml" and change the permissions, for example, if i wanted that a user could download the file, i changed his role to collaborator which has "edit" permissions, so i set the download to "permissions=edit" and if i didn´t want the user to be able to download i change the role of the user to contributor or consumer and then they couldn´t see the download action button.

Don´t forget to backup before you do any changes

Here´s a piece of code from the original xml file regarding the download behavior:


<action type="simple-link" id="onActionDownload" href="{downloadUrl}" label="actions.document.download" />
<action type="simple-link" id="onActionView" href="{viewUrl}" label="actions.document.view" />
<action type="simple-link" id="onActionDetails" permission="edit" href="{editMetadataUrl}" label="actions.document.edit-metadata" />
Note that "onActionDownload" which is the download action, and "onActionView" which is the view in browser action, don´t have a permission so everybody can see it, on the other hand, "onActionDetails", which is the "Edit Metadata" action have permission=edit", only user with editing privileges ( Admin, SiteManagers and Collaborators ) can see that action button.

So if you only want user with "Edit" privileges to be able to download files, set the permission as is:


<action type="simple-link" id="onActionDownload" permission="edit" href="{downloadUrl}" label="actions.document.download" />
<action type="simple-link" id="onActionView" permission="edit" href="{viewUrl}" label="actions.document.view" />
<action type="simple-link" id="onActionDetails" permission="edit" href="{editMetadataUrl}" label="actions.document.edit-metadata" />
This way not only they won´t be able to download it but also they will not be able to see it in the browser and easily make a copy from there. There´s several lines in the same xml file regarding download and view, so change them all. You will have to do the same for the folder-actions.get.config.xml.

For added security, if you only want the admin or sitemanager to be able to download, set the permissions to permission="delete", so only users with Delete privileges can download.

Unfortunately, Alfresco Share being such a wonderful collaboration app, it has two other ways of downloading the file, in the Version History there is also a download button, and in the Sharing section you can see the download url for the file, so what i did is to add an <#if user.isAdmin> tag to the document-versions.get.html.ftl.

Here´s the original piece of code regarding the download button, its almost at the end of the file:


<div class="actions">
       <span><a href="${url.context}/proxy/alfresco${version.downloadURL}" class="download">${msg("link.download")}</a></span>
               <#if version_index != 0>
                  <span><a id="${args.htmlid}-revert-a-${version_index}" class="revert" href="#">${msg("link.revert")}</a></span>
               </#if>
</div>
And this is the code that will only allow the Admin to see that button:


<div class="actions">
       <#if user.isAdmin>
               <span><a href="${url.context}/proxy/alfresco${version.downloadURL}" class="download">${msg("link.download")}</a></span>
        </#if>
               <#if version_index != 0>
                  <span><a id="${args.htmlid}-revert-a-${version_index}" class="revert" href="#">${msg("link.revert")}</a></span>
               </#if>
</div>

Now for the document-links you can do the same to hide the "download file url" and "document url"

<!– download link –>
<#if user.isAdmin>
   <div id="${args.htmlid}-download" class="hidden">
      <div class="url-title"><label for="${args.htmlid}-download-url">${msg("document-links.download")}</label></div>
      <input id="${args.htmlid}-download-url" class="link-value" />
      <input id="${args.htmlid}-download-button" type="button" class="copy-button" value="${msg("document-links.copy")}" />
   </div>
  
   <!– document/view link –>
   <div id="${args.htmlid}-view" class="hidden">
      <div class="url-title"><label for="${args.htmlid}-view-url">${msg("document-links.view")}</label></div>
      <input id="${args.htmlid}-view-url" class="link-value" />
      <input id="${args.htmlid}-view-button" type="button" class="copy-button" value="${msg("document-links.copy")}" />
   </div>

<#if repositoryUrl??>
   <!– webdav link –>
   <div id="${args.htmlid}-webdav" class="hidden">
      <div class="url-title"><label for="${args.htmlid}-webdav-url">${msg("document-links.webdav")}</label></div>
      <input id="${args.htmlid}-webdav-url" class="link-value" />
      <input id="${args.htmlid}-webdav-button" type="button" class="copy-button" value="${msg("document-links.copy")}" />
   </div>
</#if>

   <#– cifs link (N/A)
   <div id="${args.htmlid}-cifs" class="hidden">
      <div class="url-title"><label for="${args.htmlid}-cifs-url">${msg("document-links.cifs")}</label></div>
      <input id="${args.htmlid}-cifs-url" class="link-value" />
      <input id="${args.htmlid}-cifs-button" type="button" class="copy-button" value="${msg("document-links.copy")}" />
   </div> –>
</#if>
   <!– page link –>
   <div id="${args.htmlid}-page">

Hopefully i explained myself and maybe i helped with this issue.

utpal_desai
Champ in-the-making
Champ in-the-making
Thanks it helped me lot….! Smiley Very Happy

utpal_desai
Champ in-the-making
Champ in-the-making
I am able to disable all the options to save pdf on to desktop, I am not able to search in swf viewer.

ottovoss
Champ in-the-making
Champ in-the-making
This worked wonderfully in Alfresco Community Edition 3.4a. I'm new in Alfresco, so I'm not sure if this is the same in previous versions, but in 3.4, you are able to download the file also from the document list in each folder. When you hover over the file, links to download the file, copy it to another folder, or open in browser also appear.

Do you know where we could deactivate this links too?

Have you found another solution? This seems to me very complicated for something that should be very simple in a platform like this.

Thanks in advance.

ottovoss
Champ in-the-making
Champ in-the-making
Our friend Utpal DesaiSep  posted the answer to my question in another forum: http://www.devcomments.com/Disable-Download-Action-in-Alfresco-Share-3-3g-0-to254180.htm

This are all the files that should be modified in order to block download of Files in Document Library.

document-links.get.html.ftl
document-versions.get.html.ftl
document-actions.get.config.xml
dod5015-document-actions.get.config.xml
repo-document-actions.get.config.xml
documentlist.get.config.xml
dod5015-documentlist.get.config.xml
repo-documentlist.get.config.xml

graychan
Champ in-the-making
Champ in-the-making
An additional issue, if user records the link of action, he can download document directly.
It's a risk.

amgohan
Champ in-the-making
Champ in-the-making
Hi,

I want to thank u for this solution, it was very helpful for me.

can u help me with this case :
I want to disable download by default for all consumers but i want also assign download permission to some consumers if my client want.

thnks a lot.

ilyak
Champ in-the-making
Champ in-the-making
I want to disable download by default for all consumers but i want also assign download permission to some consumers if my client want.

So, you need to put into your document-actions.get.config.xml follow code:
<action type="simple-link" id="onActionDownload" permission="download" href="{downloadUrl}" label="actions.document.download" />

then set permissions  to user by web-scripts like this:
node.setPermission('DownloadContent', user)

jherbit
Champ in-the-making
Champ in-the-making
Hi,

otovoos sent a list of the files that have to be modified to block the download function, but, have anybody done this in the Community Versión 4.0?, if yes, could you share the new list of files?

We want to work with Alfresco Software but there is a requirement to block the download of confidential files.

Thanks in advance.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.