AnsweredAssumed Answered

Hide startworkflow for roles in Alfresco Share

Question asked by karimbuenaseda on Dec 5, 2013
Latest reply on Dec 11, 2013 by karimbuenaseda
Hi All,

Just like to inquire if what I have been doing within Alfresco Share v4.1.5 to hide the start-workflow for Consumers. What I have done is to modify the share-documentlibrary-config.xml and provide permissions in the document-assign-workflow just like below:

<action id="document-assign-workflow" type="javascript" label="actions.document.assign-workflow">
            <param name="function">onActionAssignWorkflow</param>
         <permissions>
            <permission allow="true">Write</permission>
         </permissions>
            <evaluator negate="true">evaluator.doclib.indicator.IsReadOnly</evaluator>
  </action>

this hides the start-workflow for certain roles but also hides it to the Contributor role. Is there any way to enable the start-workflow for the Contributor role while hiding it for the Consumer role?

Next thing I did to hide it in the my-task dashlet is to modify the my-task-get.js and my-task.get.html.ftl to add the following code:

my-task.get.js

<import resource="classpath:alfresco/site-webscripts/org/alfresco/components/workflow/workflow.lib.js">
<import resource="classpath:alfresco/site-webscripts/org/alfresco/callutils.js">
<import resource="classpath:alfresco/site-webscripts/org/alfresco/components/calendar/helper.js">

model.hiddenTaskTypes = getHiddenTaskTypes();

var json = remote.call("/api/sites/" + page.url.templateArgs.site + "/memberships");

var currentUser = user.name;
var role = null;

var myConfig = new XML(config.script),
   filters = [];

if(json.status == 200)
{
   var obj = eval('(' + json + + ')');
   role = obj.role;
}

if(role !== null)
{
   model.role = role;
}
else
{
model.role = "Manager";
}

"my-task.get.html.ftl"


<#if role = "Manager">
            <span class="align-right yui-button-align">
               <span class="first-child">
                  <a href="${page.url.context}/page/start-workflow?referrer=tasks" class="theme-color-1">
                     <img src="${url.context}/res/components/images/workflow-16.png" style="vertical-align: text-bottom" width="16" />
                     ${msg("link.startWorkflow")}</a>
               </span>
            </span>
</#if>

Am I on the right path regarding this one?. Appreciate your help on this guys. Thanks

Outcomes