<?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: setPermission and setOwner cannot set together? in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299915#M253045</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yeah… it seems a little bit more complex than I thought.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You have at least 3 options :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1- add a custom rule with a Java action&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is some documentation &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- how to add the new rule on the client-side : &lt;/SPAN&gt;&lt;A href="http://ecmarchitect.com/images/articles/alfresco-actions/actions-article-2ed.pdf" rel="nofollow noopener noreferrer"&gt;http://ecmarchitect.com/images/articles/alfresco-actions/actions-article-2ed.pdf&lt;/A&gt;&lt;SPAN&gt; (on page 17) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- how to create a Java action : &lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/Custom_Actions" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/Custom_Actions&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2- extend the Alfreso JavaScript API and add a new root object with a Java implementation. Maybe the easiest way to do it… An example here : &lt;/SPAN&gt;&lt;A href="http://blog.abstractive.ca/2012/06/better-alfresco-script-logging/" rel="nofollow noopener noreferrer"&gt;http://blog.abstractive.ca/2012/06/better-alfresco-script-logging/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3- create a policy component and define a behaviour on the create node event : &lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/Policy_Component" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/Policy_Component&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 May 2014 11:10:54 GMT</pubDate>
    <dc:creator>tonyrivet</dc:creator>
    <dc:date>2014-05-22T11:10:54Z</dc:date>
    <item>
      <title>setPermission and setOwner cannot set together?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299909#M253039</link>
      <description>I have a code that looks like this:var creator = document.properties["cm:creator"];document.setInheritsPermissions(false);document.removePermission("FullControl","GROUP_SEKRETARIAT");document.setPermission("Read",creator);document.setPermission("Write",creator);document.setPermission("Delete",creato</description>
      <pubDate>Mon, 19 May 2014 04:52:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299909#M253039</guid>
      <dc:creator>e-no91</dc:creator>
      <dc:date>2014-05-19T04:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: setPermission and setOwner cannot set together?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299910#M253040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think your rule is executed as the document creator ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The 2 cases you describe seem quite normal :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- if you give the permissions to the creator first, it will be ignored because at the time your creator is the owner and already have the Read, Write and Delete permissions&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- if you set the owner first, you have a permission error trying the give the permissions to the creator, beacause as the creator is not the owner anymore, he does not have the permission to give permissions on the document&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this is clear… &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the solution is to execute your rule as an admin and set the owner first.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 May 2014 10:31:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299910#M253040</guid>
      <dc:creator>tonyrivet</dc:creator>
      <dc:date>2014-05-19T10:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: setPermission and setOwner cannot set together?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299911#M253041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes. The rule is executed as document creator.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you, I understand now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To execute rule as admin is to build the java file is it?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 03:00:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299911#M253041</guid>
      <dc:creator>e-no91</dc:creator>
      <dc:date>2014-05-21T03:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: setPermission and setOwner cannot set together?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299912#M253042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, you will have to write a Java action and use &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;AuthenticationUtil.runAs()&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;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 07:37:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299912#M253042</guid>
      <dc:creator>tonyrivet</dc:creator>
      <dc:date>2014-05-21T07:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: setPermission and setOwner cannot set together?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299913#M253043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How do I write a java action? Using webscript? And where do I store the files? Ive searched about this for weeks but I still dont understand how to do it..&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It will help me a lot~&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 22:18:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299913#M253043</guid>
      <dc:creator>e-no91</dc:creator>
      <dc:date>2014-05-21T22:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: setPermission and setOwner cannot set together?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299914#M253044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you again, I manage to overcome the 1st case~ XD&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I could do this by adding a line&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;var creator = document.properties["cm:creator"];&lt;BR /&gt; &lt;BR /&gt;document.setInheritsPermissions(false);&lt;BR /&gt;document.setPermission("Contributor","GROUP_SEKRETARIAT");&lt;BR /&gt;document.setPermission("Delete",creator);&lt;BR /&gt;document.setOwner("admin");&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I code this way, the group can do whatever a contributor can do + delete any files they upload. (I've tested that without setPermission("Delete",creator), creator cannot delete at all)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And admin takes ownership, as expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BUT, if I change my code like this&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;var creator = document.properties["cm:creator"];&lt;BR /&gt; &lt;BR /&gt;document.setInheritsPermissions(false);&lt;BR /&gt;document.setPermission("Consumer","GROUP_SEKRETARIAT");&lt;BR /&gt;document.setPermission("Delete",creator);&lt;BR /&gt;document.setOwner("admin");&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The group can only read, the delete function didnt make any changes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd prefer if this code could work, just so that I could get rid of the 'Add comment' button.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 09:00:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299914#M253044</guid>
      <dc:creator>e-no91</dc:creator>
      <dc:date>2014-05-22T09:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: setPermission and setOwner cannot set together?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299915#M253045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yeah… it seems a little bit more complex than I thought.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You have at least 3 options :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1- add a custom rule with a Java action&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is some documentation &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- how to add the new rule on the client-side : &lt;/SPAN&gt;&lt;A href="http://ecmarchitect.com/images/articles/alfresco-actions/actions-article-2ed.pdf" rel="nofollow noopener noreferrer"&gt;http://ecmarchitect.com/images/articles/alfresco-actions/actions-article-2ed.pdf&lt;/A&gt;&lt;SPAN&gt; (on page 17) &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- how to create a Java action : &lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/Custom_Actions" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/Custom_Actions&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2- extend the Alfreso JavaScript API and add a new root object with a Java implementation. Maybe the easiest way to do it… An example here : &lt;/SPAN&gt;&lt;A href="http://blog.abstractive.ca/2012/06/better-alfresco-script-logging/" rel="nofollow noopener noreferrer"&gt;http://blog.abstractive.ca/2012/06/better-alfresco-script-logging/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3- create a policy component and define a behaviour on the create node event : &lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/Policy_Component" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/Policy_Component&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2014 11:10:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setpermission-and-setowner-cannot-set-together/m-p/299915#M253045</guid>
      <dc:creator>tonyrivet</dc:creator>
      <dc:date>2014-05-22T11:10:54Z</dc:date>
    </item>
  </channel>
</rss>

