<?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 problem with permissions in template -check for parent read? in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/problem-with-permissions-in-template-check-for-parent-read/m-p/141104#M98848</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;given some search results I am trying to display a link to the parent space using child.parent.url.&amp;nbsp; If a user doesn't have permissions it throws an error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ok, so I added a check for permissions&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;lt;#if child.parent.hasPermission("Read")&amp;gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;but that line throws the same error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So how can you check for permissions on the parent node when you may not have permissions on that node (and that's why you are checking in the first place) ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;child.inheritsPermissions won't work when it does inherit but adds permissions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For reference here's some of the error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;Error during processing of the template 'get(parent) failed on instance of org.alfresco.repo.template.TemplateNode'.&lt;BR /&gt;…&lt;BR /&gt;freemarker.template.TemplateModelException: get(parent) failed on instance of org.alfresco.repo.template.TemplateNode&lt;BR /&gt;…&lt;BR /&gt;Caused by: org.alfresco.repo.security.permissions.AccessDeniedException: Access Denied.&amp;nbsp; You do not have the appropriate permissions to perform this operation.&lt;BR /&gt;…&lt;BR /&gt;&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;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Sep 2007 16:04:43 GMT</pubDate>
    <dc:creator>stk137</dc:creator>
    <dc:date>2007-09-21T16:04:43Z</dc:date>
    <item>
      <title>problem with permissions in template -check for parent read?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-with-permissions-in-template-check-for-parent-read/m-p/141104#M98848</link>
      <description>given some search results I am trying to display a link to the parent space using child.parent.url.&amp;nbsp; If a user doesn't have permissions it throws an error.ok, so I added a check for permissions&amp;lt;#if child.parent.hasPermission("Read")&amp;gt;‍but that line throws the same error.So how can you check for</description>
      <pubDate>Fri, 21 Sep 2007 16:04:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-with-permissions-in-template-check-for-parent-read/m-p/141104#M98848</guid>
      <dc:creator>stk137</dc:creator>
      <dc:date>2007-09-21T16:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: problem with permissions in template -check for parent read?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-with-permissions-in-template-check-for-parent-read/m-p/141105#M98849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I see the problem! I think this will require a fix - under the covers the Template/JavaScript API should check the user has READ permissions on the parent before providing you a reference to it - and return null if it cannot be accesssed. That would make a simple null check to see if the parent is viable for access in the template/script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have raised a JIRA item for it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://issues.alfresco.com/browse/AR-1781" rel="nofollow noopener noreferrer"&gt;http://issues.alfresco.com/browse/AR-1781&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for spotting this,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Sep 2007 09:34:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-with-permissions-in-template-check-for-parent-read/m-p/141105#M98849</guid>
      <dc:creator>kevinr</dc:creator>
      <dc:date>2007-09-28T09:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: problem with permissions in template -check for parent read?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-with-permissions-in-template-check-for-parent-read/m-p/141106#M98850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I've the same problem from Java code as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My code looks like :&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;nbsp; NodeRef parentNodeRef = nodeService.getPrimaryParent(node.getNodeRef()).getParentRef();&lt;BR /&gt;&amp;nbsp; permissionService.hasPermission(parentNodeRef, …);&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;But if current user don't have READ permission on parent node, the first of both line throws an exception, and transaction is marked for rollback only. Alfresco release is 2.1.0E.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is is possible to check for READ permission on parent node ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards, Denis&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2007 10:11:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-with-permissions-in-template-check-for-parent-read/m-p/141106#M98850</guid>
      <dc:creator>dgenard</dc:creator>
      <dc:date>2007-12-03T10:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: problem with permissions in template -check for parent read?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-with-permissions-in-template-check-for-parent-read/m-p/141107#M98851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This was changed in 2.1.1E so that the call getPrimaryParent() is will not throw AccessDeniedException - instead you always get the relationship returned allowing you to inspect the permissions on the parent/child noderefs before accessing properties/content on them - that's how we fixed the jscript APIs also. You will need 2.1.1E.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2007 10:35:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-with-permissions-in-template-check-for-parent-read/m-p/141107#M98851</guid>
      <dc:creator>kevinr</dc:creator>
      <dc:date>2007-12-03T10:35:52Z</dc:date>
    </item>
  </channel>
</rss>

