<?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 Alfresco Script : is this algorithm feasible please ? --&amp;gt; in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/alfresco-script-is-this-algorithm-feasible-please-gt/m-p/126862#M89241</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is a script in a madeup language. It checks the permissions on the actual document triggered and sends an email alert to all people who can read the file except to the person who triggered the alert (he already knows…) :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;user = getcurrentuser();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;document = getcurrentdocument();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;perms = getpermissions(document);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for each(perms as perm) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (perm["username"] != user.getname()) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mail = newmail();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mail.subject = "new document "" + document.getname() + "" changed";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mail.to = getPersonFromName(perm["username"]).getemail();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mail.from = "&lt;/SPAN&gt;&lt;A class="jive-link-email-small" href="mailto:admin@mysite.com" rel="nofollow noopener noreferrer"&gt;admin@mysite.com&lt;/A&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mail.body = "blah blah " + document.geturl() + "blabla. Bye."; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mail.send();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Is thi possible using the javascript API? Could you give me a hint on how to implement the "perms = getpermissions" and "for each (perms as perm)" please? I dont know how to parse tokenised string in javascript :s&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Are discussions nodes taken care of, this way? Is there any way i can detect that the current node is a discussion and mention it in the email?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help greatly apreciated !! &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;BR /&gt;&lt;SPAN&gt;AurÃƒÂ©lien&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Oct 2007 13:37:04 GMT</pubDate>
    <dc:creator>aurelien2</dc:creator>
    <dc:date>2007-10-01T13:37:04Z</dc:date>
    <item>
      <title>Alfresco Script : is this algorithm feasible please ? --&gt;</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/alfresco-script-is-this-algorithm-feasible-please-gt/m-p/126862#M89241</link>
      <description>Here is a script in a madeup language. It checks the permissions on the actual document triggered and sends an email alert to all people who can read the file except to the person who triggered the alert (he already knows…) :user = getcurrentuser();document = getcurrentdocument();perms = getpermissi</description>
      <pubDate>Mon, 01 Oct 2007 13:37:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/alfresco-script-is-this-algorithm-feasible-please-gt/m-p/126862#M89241</guid>
      <dc:creator>aurelien2</dc:creator>
      <dc:date>2007-10-01T13:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco Script : is this algorithm feasible please ? --&gt;</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/alfresco-script-is-this-algorithm-feasible-please-gt/m-p/126863#M89242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Anyone?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am willing to pay for such answers, what company could I ask for such works? (french based company)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks !&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 11:13:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/alfresco-script-is-this-algorithm-feasible-please-gt/m-p/126863#M89242</guid>
      <dc:creator>aurelien2</dc:creator>
      <dc:date>2007-10-03T11:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco Script : is this algorithm feasible please ? --&gt;</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/alfresco-script-is-this-algorithm-feasible-please-gt/m-p/126864#M89243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The JavaScript API already has a getPermissions() method to retrieve the permissions explicitly set on a node:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://wiki.alfresco.com/wiki/JavaScript_API#Permission_and_Security_API" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/JavaScript_API#Permission_and_Security_API&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is also an API for retrieving People nodes given the username retrieved from the permission data:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://wiki.alfresco.com/wiki/JavaScript_API#People_API" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/JavaScript_API#People_API&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The issue here is that the getPermissions() method only retrieves the permissions explicity applied to a node. It does not return and calculate the permissions as inherited from any parent nodes and which therefore also apply. However using the node.parent API and the JavaScript Permissions API method inheritsPermissions() you can work out all permissions applied to a node including the inheritance chain. In addition, Groups of users are returned in the getPermissions() data, but again you can use the People API to calculate which users are in the Groups and in turn get those users emails addresses. You may want to do some background reading on the way Alfresco permissions work on our wiki first! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2007 12:32:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/alfresco-script-is-this-algorithm-feasible-please-gt/m-p/126864#M89243</guid>
      <dc:creator>kevinr</dc:creator>
      <dc:date>2007-10-03T12:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Alfresco Script : is this algorithm feasible please ? --&gt;</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/alfresco-script-is-this-algorithm-feasible-please-gt/m-p/126865#M89244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Many thanks ! I will give it a try &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;BR /&gt;&lt;SPAN&gt;BTW if i cant get this to work, is there any way i can ask a company/someone to do it instead? I sold an Alfresco install for a test to a company, but they want some customization. We dont have budget right now to buy a full licence, but we do for some development.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2007 10:36:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/alfresco-script-is-this-algorithm-feasible-please-gt/m-p/126865#M89244</guid>
      <dc:creator>aurelien2</dc:creator>
      <dc:date>2007-10-04T10:36:35Z</dc:date>
    </item>
  </channel>
</rss>

