<?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 behaviour context problem in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/behaviour-context-problem/m-p/270921#M224051</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to get a control over the users added to alfresco.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When a user is added to alfresco, I want to check the domain of the email adress and if it's one of ours, automatically enable the user account and add him to the appropriate group depending on this domain.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In order to do so, I added a custom behavior onCreateNode for cm&lt;img id="smileytongue" class="emoticon emoticon-smileytongue" src="https://connect.hyland.com/i/smilies/16x16_smiley-tongue.png" alt="Smiley Tongue" title="Smiley Tongue" /&gt;erson.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Since I already have quite a lot of webscripts written in javascript running on top of Alfresco with externalized constants and so on, I chose to write that custom behaviour in javascript too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When the user is created with the site "external invitation" feature, it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When the user is created from share user interface (&lt;/SPAN&gt;&lt;A href="http://localhost:8080/share/page/console/admin-console/users#state=panel%3Dcreate" rel="nofollow noopener noreferrer"&gt;http://localhost:8080/share/page/console/admin-console/users#state=panel%3Dcreate&lt;/A&gt;&lt;SPAN&gt;) it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When the user is created via the script console (&lt;/SPAN&gt;&lt;A href="http://code.google.com/p/share-extras/wiki/JavascriptConsole" rel="nofollow noopener noreferrer"&gt;http://code.google.com/p/share-extras/wiki/JavascriptConsole&lt;/A&gt;&lt;SPAN&gt;) it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, for the users whose account is created on ldap login (haven't tested with ldap synchronization), the script is started in an unusual way (not by a user).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This cause &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;behaviour.args[0].getChild()&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt; to evaluate to "A valid SecureContext was not provided in the RequestContext" instead of the user node.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll create a Jira since this is clearly a bug. The script should probably be called by the "System" user.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I was thinking that maybe I could force the behavior to execute with specific user rights (like the runas="admin" for the webscripts) for the time being. How can I add such a property to my spring bean?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;TLDR: Can a custom behavior be forced to execute as if started by the admin or system user?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 May 2012 08:49:57 GMT</pubDate>
    <dc:creator>scouil</dc:creator>
    <dc:date>2012-05-11T08:49:57Z</dc:date>
    <item>
      <title>behaviour context problem</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviour-context-problem/m-p/270921#M224051</link>
      <description>Hello everyone,I'm trying to get a control over the users added to alfresco.When a user is added to alfresco, I want to check the domain of the email adress and if it's one of ours, automatically enable the user account and add him to the appropriate group depending on this domain.In order to do so,</description>
      <pubDate>Fri, 11 May 2012 08:49:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviour-context-problem/m-p/270921#M224051</guid>
      <dc:creator>scouil</dc:creator>
      <dc:date>2012-05-11T08:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: behaviour context problem</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviour-context-problem/m-p/270922#M224052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use the AuthenticationUtil in the Java code when running the script (you'll have to wrap the code in onCreateNode and set the user to System. This is a sample code using the AuthenticationUtil and the System user to run code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;Object result = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork&amp;lt;Object&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public Object doWork() throws Exception &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;….&lt;BR /&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;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}, AuthenticationUtil.SYSTEM_USER_NAME);&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;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Adei&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2012 09:03:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviour-context-problem/m-p/270922#M224052</guid>
      <dc:creator>amandaluniz_z</dc:creator>
      <dc:date>2012-05-11T09:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: behaviour context problem</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviour-context-problem/m-p/270923#M224053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello amandaluniz_z and thanks for taking the time to answer me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your solution would work but would require me to switch to java for the behavior.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, as I said, I'd really like to stick with javascript and stay coherent with the existing work and share its configuration.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks anyway,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2012 09:35:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviour-context-problem/m-p/270923#M224053</guid>
      <dc:creator>scouil</dc:creator>
      <dc:date>2012-05-11T09:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: behaviour context problem</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviour-context-problem/m-p/270924#M224054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Then what I guess you can do is extend ScriptBehaviour class and configure your javascript behaviour to match your needs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2012 11:19:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviour-context-problem/m-p/270924#M224054</guid>
      <dc:creator>amandaluniz_z</dc:creator>
      <dc:date>2012-05-11T11:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: behaviour context problem</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/behaviour-context-problem/m-p/270925#M224055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, I like this idea better.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But if I'm to modify/extend alfresco source code, maybe I'd better directly fix the bug itself instead of coding around it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But that requires quite some time to get familiar with alfresco source code architecture and philosophy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll post here if I find the time to make this work. Or maybe I'll directly POST in the jira (&lt;/SPAN&gt;&lt;A href="https://issues.alfresco.com/jira/browse/ALF-14030" rel="nofollow noopener noreferrer"&gt;https://issues.alfresco.com/jira/browse/ALF-14030&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 May 2012 11:31:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/behaviour-context-problem/m-p/270925#M224055</guid>
      <dc:creator>scouil</dc:creator>
      <dc:date>2012-05-11T11:31:14Z</dc:date>
    </item>
  </channel>
</rss>

