<?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: Visibility of documents according to the State in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321648#M8649</link>
    <description>&lt;P&gt;en gros je veux juste qu'à sa création, un document soit invisible aux développeurs, mais qu'il apparaisse automatiquement dès qu'il est validé...&lt;/P&gt;</description>
    <pubDate>Thu, 20 Sep 2012 18:01:17 GMT</pubDate>
    <dc:creator>Julien_A_</dc:creator>
    <dc:date>2012-09-20T18:01:17Z</dc:date>
    <item>
      <title>Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321640#M8641</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;
&lt;P&gt;I'm currently working for an IT project and I'd like to customize the visibility of my documents according to the document's State, using the User Groups&lt;/P&gt;
&lt;P&gt;Here's my example :&lt;/P&gt;
&lt;P&gt;I created a user group called "Developer" for all our developers&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;if the document is in the &lt;STRONG&gt;Draft&lt;/STRONG&gt; state, "Developer" users cannot see the document&lt;/LI&gt;
&lt;LI&gt;when the document is in the &lt;STRONG&gt;Validated&lt;/STRONG&gt; state, it automatically appears for "Developer" people&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;How can I do that ?&lt;/P&gt;
&lt;P&gt;Thanks a lot,
Julien&lt;/P&gt;</description>
      <pubDate>Mon, 17 Sep 2012 18:13:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321640#M8641</guid>
      <dc:creator>Julien_A_</dc:creator>
      <dc:date>2012-09-17T18:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321641#M8642</link>
      <description>&lt;P&gt;The best way is to use a Security Policy manage through Nuxeo IDE :&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;to start here is the &lt;A href="http://doc.nuxeo.com/display/IDEDOC/Getting+started+with+Nuxeo+IDE"&gt;link&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Then create a Nuxeo Plugin project&lt;/LI&gt;
&lt;LI&gt;Click on yellow NX link / Security / Security Policy&lt;/LI&gt;
&lt;LI&gt;Give a name to your Security Policy (it will be the name of the classe that implements your logic) / set the order to -100 (to be sure to be the first one)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;And finally in checkPermission method fill like the that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;public Access checkPermission(Document doc, ACP mergedAcp,
        Principal principal, String permission,
        String[] resolvedPermissions, String[] additionalPrincipals)
        throws SecurityException {
    NuxeoPrincipal nxPrincipal = (NuxeoPrincipal) principal;

    boolean isReadWriteAccess = false
    for (String permissionTmp : resolbedPermissions) {
      if ("ReadWrite".equals(permissionTmp) {
        isReadWriteAccess = true;
      }
    }
    if (isReadWriteAccess &amp;amp;&amp;amp; "Validated".equals(doc.getLifeCycleState() &amp;amp;&amp;amp; nxPrincipal.isMemberOf("developer")) {
      return Access.DENY;
    }

    ... I think you understood the idea, implement your stuff...

    return Access.UNKNOWN;
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To not have bad response time and problems for paginations, you will have also to implement the query transformer (see interface the class implement).&lt;/P&gt;
&lt;P&gt;That's it.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 13:16:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321641#M8642</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-09-20T13:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321642#M8643</link>
      <description>&lt;P&gt;Super ! Merci, that's great&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 14:20:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321642#M8643</guid>
      <dc:creator>Julien_A_</dc:creator>
      <dc:date>2012-09-20T14:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321643#M8644</link>
      <description>&lt;P&gt;De rien vraiment, j'insiste&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 16:31:40 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321643#M8644</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-09-20T16:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321644#M8645</link>
      <description>&lt;P&gt;ok thanks ! I'm waiting for your answer just for Studio... I can't wait to have it ! ahah&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 16:53:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321644#M8645</guid>
      <dc:creator>Julien_A_</dc:creator>
      <dc:date>2012-09-20T16:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321645#M8646</link>
      <description>&lt;P&gt;There is other way than Security Policy to implement this use case. Here, I assume your document is draft only after creation (certainly a simplification against your use case), but you will have the idea to implement if the document goes back to draft, I let you do it:&lt;/P&gt;
&lt;P&gt;Create an eventHandler for creation Event :&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Events : Document Created&lt;/LI&gt;
&lt;LI&gt;Document type : yourDocType&lt;/LI&gt;
&lt;LI&gt;Operation chain :&lt;/LI&gt;
&lt;LI&gt;Fetch Context Document&lt;/LI&gt;
&lt;LI&gt;User &amp;amp; Groups &amp;gt; Login As (let empty field)&lt;/LI&gt;
&lt;LI&gt;Document &amp;gt; Set ACL : ReadWrite / yourGroup / aNameOfYourChoice / grant checked&lt;/LI&gt;
&lt;LI&gt;Document &amp;gt; Set ACL : Everything / Everyone / aNameOfYourChoice / grant unchecked&lt;/LI&gt;
&lt;LI&gt;User &amp;amp; Groups &amp;gt; Logout&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;And create a second eventHandler for the transition&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Events : Lifecycle transition event&lt;/LI&gt;
&lt;LI&gt;Document type : yourDocType&lt;/LI&gt;
&lt;LI&gt;Operation chain :&lt;/LI&gt;
&lt;LI&gt;Fetch Context Document&lt;/LI&gt;
&lt;LI&gt;User &amp;amp; Groups &amp;gt; Login As (let empty field)&lt;/LI&gt;
&lt;LI&gt;Document &amp;gt; remove ACL : aNameOfYourChoice&lt;/LI&gt;
&lt;LI&gt;User &amp;amp; Groups &amp;gt; Logout&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I think that's all. This is not the best implementation, I will suggest for a production server with a large volume of data a security policy. But this is fine for small/medium project.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 17:01:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321645#M8646</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-09-20T17:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321646#M8647</link>
      <description>&lt;P&gt;OK that's going to help me a lot ! You should really do a bigger tutorial about EventHandler, I just discovered it and it seems to be very, very useful ! A tutorial which would explain how to  "automatically rename the title depending on some other fields values", "inherit some metadata from other content"...&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 17:24:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321646#M8647</guid>
      <dc:creator>Julien_A_</dc:creator>
      <dc:date>2012-09-20T17:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321647#M8648</link>
      <description>&lt;P&gt;one last question&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 17:27:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321647#M8648</guid>
      <dc:creator>Julien_A_</dc:creator>
      <dc:date>2012-09-20T17:27:45Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321648#M8649</link>
      <description>&lt;P&gt;en gros je veux juste qu'à sa création, un document soit invisible aux développeurs, mais qu'il apparaisse automatiquement dès qu'il est validé...&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 18:01:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321648#M8649</guid>
      <dc:creator>Julien_A_</dc:creator>
      <dc:date>2012-09-20T18:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321649#M8650</link>
      <description>&lt;P&gt;Ok my mistake I read can instead cannot... I modify my answer to follow your question.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 18:48:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321649#M8650</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-09-20T18:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321650#M8651</link>
      <description>&lt;P&gt;modification done.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Sep 2012 19:04:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321650#M8651</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-09-20T19:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321651#M8652</link>
      <description>&lt;P&gt;thank you for your help &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; have a nice day&lt;/P&gt;</description>
      <pubDate>Thu, 27 Sep 2012 10:00:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321651#M8652</guid>
      <dc:creator>Julien_A_</dc:creator>
      <dc:date>2012-09-27T10:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Visibility of documents according to the State</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321652#M8653</link>
      <description>&lt;P&gt;we plan to create a documentation about that.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2012 14:38:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/visibility-of-documents-according-to-the-state/m-p/321652#M8653</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-10-04T14:38:33Z</dc:date>
    </item>
  </channel>
</rss>

