<?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 upgrade from 8.2 to 9.3 -- BaseSession.hasPermission change in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/upgrade-from-8-2-to-9-3-basesession-haspermission-change/m-p/318557#M5558</link>
    <description>&lt;P&gt;We are upgrading from 8.2 to 9.3. We have some existing unit tests to test extensions we've built that are designed to test concurrency scenarios. There is a difference in how the &lt;CODE&gt;BaseSession.hasPermission&lt;/CODE&gt; method executes from 8.2 to 9.3. In both versions, &lt;CODE&gt;BaseSession.hasPermission&lt;/CODE&gt; calls &lt;CODE&gt;ClientLoginModule.getCurrentPrincipal&lt;/CODE&gt;. In 8.2, when running as a separate thread, the &lt;CODE&gt;getCurrentPrincipal&lt;/CODE&gt; method returns null and &lt;CODE&gt;hasPermission&lt;/CODE&gt; retrurns true. In 9.3 from a separate thread, &lt;CODE&gt;getCurrentPrincipal&lt;/CODE&gt; method also returns null but then &lt;CODE&gt;hasPermission&lt;/CODE&gt; returns false. The &lt;EM&gt;null return&lt;/EM&gt; triggers the different behavior in the &lt;CODE&gt;BaseSession.hasPermission&lt;/CODE&gt; method between 8.2 and 9.3. I can overcome this by preceding the &lt;CODE&gt;getUserModel&lt;/CODE&gt; call inside the thread with the following statement: &lt;CODE&gt;Framework.Login();&lt;/CODE&gt;. This eliminates the null return. But I'm wondering if there's a better approach. Thanks&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@Test
public void foo() throws Exception {
    UserManager userManager = Framework.getLocalService(UserManager.class);
    userManager.getUserModel("ex-1");
    Executors.newFixedThreadPool(1).execute(new FutureTask&amp;lt;&amp;gt;(() -&amp;gt; {
        UserManager userManager = Framework.getLocalService(UserManager.class);
        userManager.getUserModel("ex-2");
    }));
}      
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 04 Jan 2018 17:27:36 GMT</pubDate>
    <dc:creator>Eric_Ace</dc:creator>
    <dc:date>2018-01-04T17:27:36Z</dc:date>
    <item>
      <title>upgrade from 8.2 to 9.3 -- BaseSession.hasPermission change</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/upgrade-from-8-2-to-9-3-basesession-haspermission-change/m-p/318557#M5558</link>
      <description>&lt;P&gt;We are upgrading from 8.2 to 9.3. We have some existing unit tests to test extensions we've built that are designed to test concurrency scenarios. There is a difference in how the &lt;CODE&gt;BaseSession.hasPermission&lt;/CODE&gt; method executes from 8.2 to 9.3. In both versions, &lt;CODE&gt;BaseSession.hasPermission&lt;/CODE&gt; calls &lt;CODE&gt;ClientLoginModule.getCurrentPrincipal&lt;/CODE&gt;. In 8.2, when running as a separate thread, the &lt;CODE&gt;getCurrentPrincipal&lt;/CODE&gt; method returns null and &lt;CODE&gt;hasPermission&lt;/CODE&gt; retrurns true. In 9.3 from a separate thread, &lt;CODE&gt;getCurrentPrincipal&lt;/CODE&gt; method also returns null but then &lt;CODE&gt;hasPermission&lt;/CODE&gt; returns false. The &lt;EM&gt;null return&lt;/EM&gt; triggers the different behavior in the &lt;CODE&gt;BaseSession.hasPermission&lt;/CODE&gt; method between 8.2 and 9.3. I can overcome this by preceding the &lt;CODE&gt;getUserModel&lt;/CODE&gt; call inside the thread with the following statement: &lt;CODE&gt;Framework.Login();&lt;/CODE&gt;. This eliminates the null return. But I'm wondering if there's a better approach. Thanks&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@Test
public void foo() throws Exception {
    UserManager userManager = Framework.getLocalService(UserManager.class);
    userManager.getUserModel("ex-1");
    Executors.newFixedThreadPool(1).execute(new FutureTask&amp;lt;&amp;gt;(() -&amp;gt; {
        UserManager userManager = Framework.getLocalService(UserManager.class);
        userManager.getUserModel("ex-2");
    }));
}      
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jan 2018 17:27:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/upgrade-from-8-2-to-9-3-basesession-haspermission-change/m-p/318557#M5558</guid>
      <dc:creator>Eric_Ace</dc:creator>
      <dc:date>2018-01-04T17:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: upgrade from 8.2 to 9.3 -- BaseSession.hasPermission change</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/upgrade-from-8-2-to-9-3-basesession-haspermission-change/m-p/318558#M5559</link>
      <description>&lt;P&gt;note - original post had an error which I've corrected...&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 17:37:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/upgrade-from-8-2-to-9-3-basesession-haspermission-change/m-p/318558#M5559</guid>
      <dc:creator>Eric_Ace</dc:creator>
      <dc:date>2018-01-04T17:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: upgrade from 8.2 to 9.3 -- BaseSession.hasPermission change</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/upgrade-from-8-2-to-9-3-basesession-haspermission-change/m-p/318559#M5560</link>
      <description>&lt;P&gt;Nuxeo folks - I'm seeing this elsewhere. When invoking directory functionality from within event handlers (i.e. to add/modify Directory entries) the BaseSession checkPermission method gets a null principal from the ClientLoginModule but whereas before, NULL was interpreted as "you can do anything" now it is interpreted as "you can do nothing." So the code fails the permission check and aborts. So I'm adding Framework.login() in places where I have these event handlers but that can't be right. Help is appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 19:26:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/upgrade-from-8-2-to-9-3-basesession-haspermission-change/m-p/318559#M5560</guid>
      <dc:creator>Eric_Ace</dc:creator>
      <dc:date>2018-01-05T19:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: upgrade from 8.2 to 9.3 -- BaseSession.hasPermission change</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/upgrade-from-8-2-to-9-3-basesession-haspermission-change/m-p/318560#M5561</link>
      <description>&lt;P&gt;Yes this change was done on purpose (&lt;A href="https://jira.nuxeo.com/browse/NXP-22463"&gt;NXP-22463&lt;/A&gt;) to improve the security of directories.&lt;/P&gt;
&lt;P&gt;In unit tests, you will have to use a login mechanism to provide an explicit user to the authentication stack. I can be as simple as calling your code inside &lt;CODE&gt;Framework.doPrivileged&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 14:27:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/upgrade-from-8-2-to-9-3-basesession-haspermission-change/m-p/318560#M5561</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2018-01-11T14:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: upgrade from 8.2 to 9.3 -- BaseSession.hasPermission change</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/upgrade-from-8-2-to-9-3-basesession-haspermission-change/m-p/318561#M5562</link>
      <description>&lt;P&gt;Ok Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2018 11:39:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/upgrade-from-8-2-to-9-3-basesession-haspermission-change/m-p/318561#M5562</guid>
      <dc:creator>Eric_Ace</dc:creator>
      <dc:date>2018-01-12T11:39:30Z</dc:date>
    </item>
  </channel>
</rss>

