cancel
Showing results for 
Search instead for 
Did you mean: 

Restric content actions in a space.

sidi
Champ in-the-making
Champ in-the-making
I've create a space and invite a user as a Consumer, but when clicking actions in the content list appears: Copy, Visualize and Start Advanced Workflow. ¿Can anybody tell me how to get the Start Adva….  option out of the actions list?.
Thanks in advance.
4 REPLIES 4

sidi
Champ in-the-making
Champ in-the-making
I've create a space and invite a user as a Consumer, but when clicking actions in the content list appears: Copy, Visualize and Start Advanced Workflow. ¿Can anybody tell me how to get the Start Adva….  option out of the actions list?.
Thanks in advance.

No answers….. Smiley Surprisedops:
Maybe is an obvious question, but I really don't know how to do it. ¿Can anybody point me in the correct direction?.
Best Regarads.

frederick
Champ in-the-making
Champ in-the-making
Hi,

There are several options here, it depends on what exactly you want to do.
For whom must the button be removed? Users that have no write permission? Or everyone?

To attach permission checks to the button, the easiest option is to override the action configuration (defined in web-client-config-workflow-actions.xml):
         <action id="start_workflow">
            <label-id>start_workflow</label-id>
            <image>/images/icons/new_workflow.gif</image>
            <evaluator>org.alfresco.web.action.evaluator.StartWorkflowEvaluator</evaluator>
            <action>wizard:startWorkflow</action>
            <action-listener>#{WizardManager.setupParameters}</action-listener>
            <params>
               <param name="item-to-workflow">#{actionContext.id}</param>
            </params>
         </action>
If you add the following:
         <permissions>
               <permission allow="true">Write</permission>
            </permissions>
Only users with write permission will see the button.

If you have more advanced requirements, you will have to write an Evaluator class. The default StartWorkflowEvaluator only hides the button from the Guest user. You can extend this class and add any logic you want (e.g. space-dependent). Insert your extended class in the configuration shown above.

Kind regards,

sidi
Champ in-the-making
Champ in-the-making
Thanks Frederick, for such a  fast answer.

I would not like to change any configuration file. Only in the extend mode, and the restriction applies only in an specific space, what would you suggest?. 
Thanks in advance.

frederick
Champ in-the-making
Champ in-the-making
If by "extend mode" you mean only adding things to the extension folder: yes that is possible, but it requires some Java programming.
You would have to:

1. Modify web-client-config-custom.xml in the extensions folder and insert the following:

<action id="start_workflow">
            <label-id>start_workflow</label-id>
            <image>/images/icons/new_workflow.gif</image>
            <evaluator>my.package.CustomStartWorkflowEvaluator</evaluator>
            <action>wizard:startWorkflow</action>
            <action-listener>#{WizardManager.setupParameters}</action-listener>
            <params>
               <param name="item-to-workflow">#{actionContext.id}</param>
            </params>
         </action>

2. Create and compile a Java class "my.package.CustomStartWorkflowEvaluator". It contains logic that returns false when the Node acted upon is one of the spaces where you do not want to show the button.

Put this class in the folder "shared/classes/my/package" or export it to a JAR and put it in "shared/lib".

You'll find more information on these action buttons here: http://wiki.alfresco.com/wiki/Externalised_Client_Actions

Kind regards,