<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: behaviourFilter.disableBehaviour in JavaScript in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287756#M240886</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can we go a little more low level.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been trying to create a javascript extension as Romschn adviced but I can't figure out how to deploy my Java Class and the Bean.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can we have some documentation or some step on how to achieve this, I'm sure it's not something to complicated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Bert&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Aug 2016 13:02:13 GMT</pubDate>
    <dc:creator>beber7</dc:creator>
    <dc:date>2016-08-22T13:02:13Z</dc:date>
    <item>
      <title>behaviourFilter.disableBehaviour in JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287748#M240878</link>
      <description>Hi,How can I do the behaviour disable in javascript as it is behaviourFilter.disableBehaviour(nodeRef, ContentModel.ASPECT_AUDITABLE);‍‍‍in Java. Thanks</description>
      <pubDate>Tue, 15 Apr 2014 13:14:18 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287748#M240878</guid>
      <dc:creator>thbaymet</dc:creator>
      <dc:date>2014-04-15T13:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: behaviourFilter.disableBehaviour in JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287749#M240879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Don't think you can.&amp;nbsp;&amp;nbsp;&amp;nbsp; You probably need to add another root scoped object to alfresco script.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2014 13:39:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287749#M240879</guid>
      <dc:creator>mrogers</dc:creator>
      <dc:date>2014-04-15T13:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: behaviourFilter.disableBehaviour in JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287750#M240880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can achieve this by writing a custom javascript extension.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Have tried to provide you the steps at high-level below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Create a java class which extends BaseProcessorExtension&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Register the class in your context.xml&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;lt;bean id="myjscriptbean" parent="baseJavaScriptExtension"&amp;nbsp; class="com.my.jscript"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;property name="extensionName"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;value&amp;gt;myjscript&amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/property&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;property name="behaviourFilter" ref="policyBehaviourFilter" /&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;!– you may inject other required services if you want –&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/bean&amp;gt;&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;3. In your java class, create public method and inside that method, perform behaviourFilter.disableBehaviour.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. From the javascript, invoke the method using myjscript.methodname.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2014 17:23:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287750#M240880</guid>
      <dc:creator>romschn</dc:creator>
      <dc:date>2014-04-15T17:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: behaviourFilter.disableBehaviour in JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287751#M240881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've already tried that and it didn't work. I've created a topic in the french forum about that:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://forums.alfresco.com/fr/forum/d%C3%A9veloppement/d%C3%A9veloppement-autour-dalfresco/d%C3%A9sactivation-des-behaviours-de-laspect-auditable" rel="nofollow noopener noreferrer"&gt;https://forums.alfresco.com/fr/forum/d%C3%A9veloppement/d%C3%A9veloppement-autour-dalfresco/d%C3%A9sactivation-des-behaviours-de-laspect-auditable&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've also tried to create a new action based on "executeScript": it doesn't work neither.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 07:45:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287751#M240881</guid>
      <dc:creator>mlagneaux</dc:creator>
      <dc:date>2014-04-22T07:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: behaviourFilter.disableBehaviour in JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287752#M240882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just one more thing: as far as i'm concerned, i didn't try to do that in a webscript but in a script called by executeScript action in Alfresco Explorer. Perhaps there's a difference in the way transactions are managed in those 2 cases.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 07:48:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287752#M240882</guid>
      <dc:creator>mlagneaux</dc:creator>
      <dc:date>2014-04-22T07:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: behaviourFilter.disableBehaviour in JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287753#M240883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Why not create a custom action ,in your java action you can disable behaviour and do oher work.Then call your custom action in explorer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 09:06:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287753#M240883</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2014-04-22T09:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: behaviourFilter.disableBehaviour in JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287754#M240884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;@mlagneaux - The approach I have provided does work both the ways - either through webscript or through Run Action &amp;gt; Execute Script &amp;gt; your javascript having a method call using custom javascript extension implemented above.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not sure what you have tried did not work for you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Apr 2014 11:58:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287754#M240884</guid>
      <dc:creator>romschn</dc:creator>
      <dc:date>2014-04-22T11:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: behaviourFilter.disableBehaviour in JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287755#M240885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As Ramesh indicates you can create a javascript root object to do this. I think that is the preferable way of doing this. I would add the caveat that unless you are careful any user may be able to utilize your script extensions so be careful what you expose or add code in your method to make certain that the user has whatever minimum role/permissions you want associated with the action.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Having said that there is a sneaky way of doing this with pure JavaScript if your script is part of a web script. JavaScript run from a web script that is loaded from the classpath has elevated permissions compared to a web script that is run with the execute script action or that is loaded from the repository. Also, if this is a regular script and you execute it from the JavaScript Console (see Share Extras on GitHub), you will also get the elevated security. With the elevated security you have access to the Package "root object" that Rhino makes available; with this you can do things like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;var foo = new Package.java.io.File("test.txt");&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;now you have a JavaScript object foo that can access the Java File object you just constructed. Given this insight you can get a handle on the Alfresco Spring Application Context. From that you can obtain the bean named policyBehaviourFilter. From there you can call the disableBehaviour() method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I plan to show details of how to do this exact thing in my talk at summit this year.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Aug 2014 02:04:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287755#M240885</guid>
      <dc:creator>binduwavell</dc:creator>
      <dc:date>2014-08-10T02:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: behaviourFilter.disableBehaviour in JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287756#M240886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can we go a little more low level.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been trying to create a javascript extension as Romschn adviced but I can't figure out how to deploy my Java Class and the Bean.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can we have some documentation or some step on how to achieve this, I'm sure it's not something to complicated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Bert&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Aug 2016 13:02:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287756#M240886</guid>
      <dc:creator>beber7</dc:creator>
      <dc:date>2016-08-22T13:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: behaviourFilter.disableBehaviour in JavaScript</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287757#M240887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Okay, I finally figured it out.. SO i'm sharing this to help others, since it's not very clear or explained at all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To do a custom root object, or javascript api extension you need to create an AMP file. ( And it's the only way according to what I read in alfresco documentation ).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To create an amp use the following maven command :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mvn archetype:generate -Dfilter=org.alfresco: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pick option 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You need to add your Java file at the path &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/src/main/java of your amp folder previously generated&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then add the service-context at &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;src/main/amp/config/alfresco/module/repo-amp/context/service-context.xml&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can build your amp using the command &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;mvn clean install&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;—————-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Go to target, get your amp file freshly created and upload it on your server at &amp;lt;your_alfresco_install&amp;gt; (often /opt/alfresco-share/) copy in /amps&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Execute bin/apply_amps.sh&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then execute alfreso.sh restart&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There you go &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here are the two best link to my opinion to understand how it works :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;How to create the amp : &lt;/SPAN&gt;&lt;A href="http://docs.alfresco.com/5.1/tasks/alfresco-sdk-tutorials-share-amp-archetype.html" rel="nofollow noopener noreferrer"&gt;http://docs.alfresco.com/5.1/tasks/alfresco-sdk-tutorials-share-amp-archetype.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;How to modify/custom the amp : &lt;/SPAN&gt;&lt;A href="http://docs.alfresco.com/5.1/references/dev-extension-points-javascript-root-objects.html" rel="nofollow noopener noreferrer"&gt;http://docs.alfresco.com/5.1/references/dev-extension-points-javascript-root-objects.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;For the runAS : &lt;/SPAN&gt;&lt;A href="https://shahpritesh.wordpress.com/2013/07/17/run-javascript-function-as-admin-privileges/comment-page-1/#comment-53" rel="nofollow noopener noreferrer"&gt;https://shahpritesh.wordpress.com/2013/07/17/run-javascript-function-as-admin-privileges/comment-page-1/#comment-53&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck everyone !&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Aug 2016 15:28:05 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviourfilter-disablebehaviour-in-javascript/m-p/287757#M240887</guid>
      <dc:creator>beber7</dc:creator>
      <dc:date>2016-08-22T15:28:05Z</dc:date>
    </item>
  </channel>
</rss>

