<?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: Is it possible to know if a particular permission is grant anywhere in Nuxeo? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314698#M1699</link>
    <description>&lt;P&gt;For instance you can create your ActionsBean class with proper functions.
Then you should choose a xhtml context with your functions.&lt;/P&gt;
&lt;P&gt;In your example probably you can use a standard query to execute your SQL, so it is easy to do.
It will be a bit more complicated if your query have to be pure (without a permission filtration).&lt;/P&gt;</description>
    <pubDate>Sat, 10 Nov 2012 00:04:58 GMT</pubDate>
    <dc:creator>adam_bo_</dc:creator>
    <dc:date>2012-11-10T00:04:58Z</dc:date>
    <item>
      <title>Is it possible to know if a particular permission is grant anywhere in Nuxeo?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314693#M1694</link>
      <description>&lt;P&gt;In our developpement in Nuxeo, we added some new permissions. We want to know if a particular permission is grant anywhere in Nuxeo for a specific user or group. Is it possible? If we look directly into the database, it's really easy to answer to the question with a simple query on acl table.&lt;/P&gt;
&lt;P&gt;In Nxql, we would like to see something like that:
Select * From Document WHERE ecm:acl='Our new permission'
In this example, if this query returns result, we have at least one document where permission apply.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 25 Oct 2012 21:55:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314693#M1694</guid>
      <dc:creator>maxr_</dc:creator>
      <dc:date>2012-10-25T21:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to know if a particular permission is grant anywhere in Nuxeo?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314694#M1695</link>
      <description>&lt;P&gt;Nuxeo doesn't support this at the moment.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Edit&lt;/STRONG&gt;: You're describing two different use cases for what you call a permisison.&lt;/P&gt;
&lt;P&gt;The first use case is checking if a user has a global setting that enables him to see or not a report. That's the notion of a Role, which you can easily apply to Nuxeo using a user group.&lt;/P&gt;
&lt;P&gt;The second use case is doing a query and filtering on a permission other than Browse, and that's not supported, queries are only done on Browse by definition. If you want to filter documents by some kind of attribute, then just add a flag or attribute on the document. Don't use permissions for that.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2012 17:25:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314694#M1695</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2012-11-09T17:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to know if a particular permission is grant anywhere in Nuxeo?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314695#M1696</link>
      <description>&lt;P&gt;what exactly do you want to do with the result or where do you plan to use it?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2012 18:19:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314695#M1696</guid>
      <dc:creator>adam_bo_</dc:creator>
      <dc:date>2012-11-09T18:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to know if a particular permission is grant anywhere in Nuxeo?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314696#M1697</link>
      <description>&lt;P&gt;I don't want to enter in details. I will try to summarize our needs.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2012 19:26:07 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314696#M1697</guid>
      <dc:creator>maxr_</dc:creator>
      <dc:date>2012-11-09T19:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to know if a particular permission is grant anywhere in Nuxeo?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314697#M1698</link>
      <description>&lt;P&gt;The code below works in test context (mvn test) when we use the embeded database.&lt;/P&gt;
&lt;P&gt;Does not work with the Postgresql database because the NXQLQueryMaker.buildQuery() internals don't take into account the permissions array when the dialect.supportsReadAcl() is true.&lt;/P&gt;
&lt;P&gt;Should we fill a bug for this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@Test
public void testQuery() throws Exception {

    String permission = "AM_CLASSIFY";
    SecurityService securityService = NXCore.getSecurityService();

    Principal principal = new PrincipalImpl(TEST_USER);

    String[] principalsToCheck = SecurityService
            .getPrincipalsToCheck(principal);
    QueryFilter qfilter = new QueryFilter(principal, principalsToCheck,
            new String[] { permission }, null,
            securityService.getPoliciesQueryTransformers(session
                    .getRepositoryName()), 1, 0); 

    Query query = ((AbstractSession) session).getSession().createQuery(
            "SELECT * FROM Document", Query.Type.NXQL);

    FilterableQuery filterableQuery = (FilterableQuery) query;
    QueryResult results = filterableQuery.execute(qfilter, false);
    assertTrue("No document matches", results.count() &amp;gt; 0); 

    principal = new PrincipalImpl(TEST_USER + "2");
    permission = "AM_DECLARE";
    principalsToCheck = SecurityService.getPrincipalsToCheck(principal);
    qfilter = new QueryFilter(principal, principalsToCheck,
            new String[] { permission }, null,
            securityService.getPoliciesQueryTransformers(session
                    .getRepositoryName()), 1, 0); 

    results = filterableQuery.execute(qfilter, false);
    assertTrue(results.count() &amp;gt; 0); 

}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Nov 2012 20:05:18 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314697#M1698</guid>
      <dc:creator>patrek</dc:creator>
      <dc:date>2012-11-09T20:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to know if a particular permission is grant anywhere in Nuxeo?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314698#M1699</link>
      <description>&lt;P&gt;For instance you can create your ActionsBean class with proper functions.
Then you should choose a xhtml context with your functions.&lt;/P&gt;
&lt;P&gt;In your example probably you can use a standard query to execute your SQL, so it is easy to do.
It will be a bit more complicated if your query have to be pure (without a permission filtration).&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2012 00:04:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314698#M1699</guid>
      <dc:creator>adam_bo_</dc:creator>
      <dc:date>2012-11-10T00:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to know if a particular permission is grant anywhere in Nuxeo?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314699#M1700</link>
      <description>&lt;P&gt;When the "read acl" optimizations are enabled, it is assumed that all queries are done only on the Browse permission, so it's not really a bug. As these optimizations are necessary for any large volume, let's just say that using the low-level &lt;CODE&gt;Session&lt;/CODE&gt; APIs directly and doing your own &lt;CODE&gt;QueryFilter&lt;/CODE&gt; filtering is not supported. Only &lt;CODE&gt;CoreSession&lt;/CODE&gt; is a supported API.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2012 11:30:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/is-it-possible-to-know-if-a-particular-permission-is-grant/m-p/314699#M1700</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2012-11-12T11:30:52Z</dc:date>
    </item>
  </channel>
</rss>

