<?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 Javascript - 'run as', authenticate as another user in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/javascript-run-as-authenticate-as-another-user/m-p/206604#M159734</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This topic is somehow linked/related to to this &lt;/SPAN&gt;&lt;A href="http://forums.alfresco.com/en/viewtopic.php?f=9&amp;amp;t=16666#p55979" rel="nofollow noopener noreferrer"&gt;http://forums.alfresco.com/en/viewtopic.php?f=9&amp;amp;t=16666#p55979&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can a Javascript be run as another user, or can I authenticate (getting another authentication context, ticket) as another user within the script?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Feb 2009 13:15:25 GMT</pubDate>
    <dc:creator>fx3000se</dc:creator>
    <dc:date>2009-02-17T13:15:25Z</dc:date>
    <item>
      <title>Javascript - 'run as', authenticate as another user</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-run-as-authenticate-as-another-user/m-p/206604#M159734</link>
      <description>This topic is somehow linked/related to to this http://forums.alfresco.com/en/viewtopic.php?f=9&amp;amp;t=16666#p55979Can a Javascript be run as another user, or can I authenticate (getting another authentication context, ticket) as another user within the script?</description>
      <pubDate>Tue, 17 Feb 2009 13:15:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-run-as-authenticate-as-another-user/m-p/206604#M159734</guid>
      <dc:creator>fx3000se</dc:creator>
      <dc:date>2009-02-17T13:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - 'run as', authenticate as another user</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-run-as-authenticate-as-another-user/m-p/206605#M159735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This topic is somehow linked/related to to this &lt;A href="http://forums.alfresco.com/en/viewtopic.php?f=9&amp;amp;t=16666#p55979" rel="nofollow noopener noreferrer"&gt;http://forums.alfresco.com/en/viewtopic.php?f=9&amp;amp;t=16666#p55979&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Can a Javascript be run as another user, or can I authenticate (getting another authentication context, ticket) as another user within the script?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;I wrote an extension that wraps AuthenticationUtil.runAs(…) to allow running a javascript function as "system" (I have no need for specifying a specific user). For obvious security reasons, this is only available for scripts stored on the classpath (most webscripts): you wouldn't want a user to drop a script in Data Dictionary/Scripts that allows him to impersonate and do things on behalf of another user?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Usage:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;var result = ubic.utils.runAsSystem(function() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // here, the current user used for ACL checking is "system"&lt;BR /&gt;&amp;nbsp; });&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't contribute the code but it's really easy to write your own (the AuthenticationUtil.RunAsWork implementation is no more than 2 lines long!)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2009 11:33:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-run-as-authenticate-as-another-user/m-p/206605#M159735</guid>
      <dc:creator>t_broyer</dc:creator>
      <dc:date>2009-02-18T11:33:50Z</dc:date>
    </item>
  </channel>
</rss>

