cancel
Showing results for 
Search instead for 
Did you mean: 

Hide startworkflow for roles in Alfresco Share

karimbuenaseda
Champ on-the-rise
Champ on-the-rise
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
2 REPLIES 2

sujaypillai
Confirmed Champ
Confirmed Champ
I would suggest you to write a custom evaluator which hides the "Start Workflow" for Consumers. See one of the reply in my earlier post - https://forums.alfresco.com/forum/installation-upgrades-configuration-integration/configuration/rest...

hi Sujay, Thanks for this. since this will only be applicable in hiding the start workflow under the document pane. Is there another way that the start-workflow would be hidden under the my-task dashlet?.

Thank You