Disable/Enable action and rule with a properties file on alfresco/share

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Established Member II

Disable/Enable action and rule with a properties file on alfresco/share

Jump to solution

Hi, i want to know if is possible to disable a specific action or rule with a specific property true/false from a specific properties file like the global.properties, so when i stop and restart alfresco or share i can manage my customize action wihout involved changes on the permissions of the users.

Greetings.

1 Solution

Accepted Solutions
Highlighted
Customer

Re: Disable/Enable action and rule with a properties file on alfresco/share

Jump to solution

Hi:

Maybe defining a surf extension module for the defined actions, in configurations section, is enough for this case. This will allow you to hide/show action when the module is disabled/enabled. It is more dynamic than properties related.

Surf Extension Modules | Alfresco Documentation 

Regards.

--C.

View solution in original post

4 Replies
Highlighted
Advanced II

Re: Disable/Enable action and rule with a properties file on alfresco/share

Jump to solution

Can you give an example?

It will be easier to understand what you want to achieve, and then give you some ideas.

Highlighted
Established Member II

Re: Disable/Enable action and rule with a properties file on alfresco/share

Jump to solution

hi ty for response , for example i have three action myAction1 , myAction2 and myAction3 , i use these actions with all user without restriction based on the group or permission of the single user.

So now i have three alfresco machine and everyone has these actions, but for time to time i need to disable/enable these action for the single machine, for now i just remove the action java class i made  or install/uninstall the relative amp component,  but i want to take control of this for my reasons with some boolean value on some properties file like this for each alfresco machine :

#enable/disable myaction1

enableMyAction1=false

#enable/disable myaction2

enableMyAction2=true

#enable/disable myaction3

enableMyAction3=false

i just want to know if is possible to make alfresco read these properties and disable the relative actions before load the webapps alfresco and share.

ty in advance.

Highlighted
Customer

Re: Disable/Enable action and rule with a properties file on alfresco/share

Jump to solution

Hi:

Maybe defining a surf extension module for the defined actions, in configurations section, is enough for this case. This will allow you to hide/show action when the module is disabled/enabled. It is more dynamic than properties related.

Surf Extension Modules | Alfresco Documentation 

Regards.

--C.

View solution in original post

Highlighted
Established Member II

Re: Disable/Enable action and rule with a properties file on alfresco/share

Jump to solution

Hi Cesar, you are right indeed the Alfresco Surf extension seem to be the right path to follow,  i read the documentation and came up with this piece of code, i put for anyone have a similar problem or for any other suggestion:

<!--
File: tomcat/shared/classes/alfresco/web-extension/site-data/extensions/myaction1-extensions-modules.xml
-->
<extension>
    <modules>
        <module>
            <id>Document Library Actions - My Action view</id>
            <version>1.0</version>
            <auto-deploy>true</auto-deploy>
            <configurations>                                  
                <config evaluator="string-compare" condition="DocLibActions">
                <!-- Action definitions -- >
                <actions>
                         <!-- My Action1 -->
                        <action id="myAction1" type="javascript" label="actions.myaction1">
                              < !--                              
                              Evaluator to disable My Action 1 for all users.
                              Using Evaluator, we can configure Actions to be visible or not in the UI
                              -- >
                              <evaluator>alfresco.myaction1.disable</evaluator>
                              <evaluator negate="true">alfresco.myaction1.isLocked</evaluator>
                        </action>                        
                 </actions>
                </config>
            </configurations>     
        </module>
    </modules>
</extension>

<!--
File: tomcat/shared/classes/alfresco/web-extension/messages/myaction1-custom.properties
-->

alfresco.myaction1.enable = false
alfresco.myaction1.disable = true
alfresco.myaction1.isLocked = false

<!--
File: tomcat/shared/classes/alfresco/web-extension/myAction1-context.xml
-->

<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

    <!--
     Define beans related to this Share extension here, such as
      evaluators and resource bootstrapping.

      Note. Any configuration related to the whole Share.war webapp
            (i.e. not specific to this share extension) should be
             placed in the tomcat/shared/classes/alfresco/web-extension/add-action-doclib-share-context.xml file
    -->
    <!-- Add module specific messages and labels -->
    <bean id="myAction1.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
        <property name="resourceBundles">
            <list>
                <!-- Load Properties : myaction1-custom.properties -->
                <value>alfresco.web-extension.messages.myaction1-custom</value>
            </list>
        </property>
    </bean>
</beans>