<?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 Notify user with an email when user's granted permission to see a file in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/notify-user-with-an-email-when-user-s-granted-permission-to-see/m-p/126692#M34483</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;is there a way to&amp;nbsp;notify users with an email when user's granted permission to see a file.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="per.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/955iCC6D437A6375AF41/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Mon, 21 Dec 2020 20:43:02 GMT</pubDate>
    <dc:creator>Rildo</dc:creator>
    <dc:date>2020-12-21T20:43:02Z</dc:date>
    <item>
      <title>Notify user with an email when user's granted permission to see a file</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/notify-user-with-an-email-when-user-s-granted-permission-to-see/m-p/126692#M34483</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;is there a way to&amp;nbsp;notify users with an email when user's granted permission to see a file.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="per.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/955iCC6D437A6375AF41/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 20:43:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/notify-user-with-an-email-when-user-s-granted-permission-to-see/m-p/126692#M34483</guid>
      <dc:creator>Rildo</dc:creator>
      <dc:date>2020-12-21T20:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Notify user with an email when user's granted permission to see a file</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/notify-user-with-an-email-when-user-s-granted-permission-to-see/m-p/126693#M34484</link>
      <description>&lt;P&gt;Nothing ootb, however you can implement a custom behavior using &lt;A href="https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/repo/security/permissions/PermissionServicePolicies.java" target="_blank" rel="noopener nofollow noreferrer"&gt;PermissionServicePolicies&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;

&lt;PRE&gt;org.alfresco.repo.security.permissions.PermissionServicePolicies&lt;BR /&gt;&lt;A href="https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/repo/security/permissions/PermissionServicePolicies.java#L44" target="_blank" rel="noopener nofollow noreferrer"&gt;org.alfresco.repo.security.permissions.PermissionServicePolicies.OnGrantLocalPermission&lt;/A&gt;&lt;/PRE&gt;
&lt;P&gt;You must be using alfresco version 5.2.g and above in order to use&amp;nbsp;&lt;A href="https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresco/repo/security/permissions/PermissionServicePolicies.java" target="_blank" rel="noopener nofollow noreferrer"&gt;PermissionServicePolicies&lt;/A&gt;&amp;nbsp;, this class was not available before alfresco 5.2.g if i remember correctly.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Example&lt;/U&gt;:&lt;/P&gt;
&lt;PRE&gt;public class PermissionChangeBehavior implements PermissionServicePolicies.OnGrantLocalPermission, InitializingBean {

	private static Log logger = LogFactory.getLog(PermissionChangeBehavior.class);

	private PolicyComponent policyComponent;

	@Override
	public void onGrantLocalPermission(final NodeRef nodeRef, final String authority, final String permission) {
		logger.info("onGrantLocalPermission invoked for nodeRef: " + nodeRef + " | authority: " + authority
				+ " | permission: " + permission);
		// TODO:: Notify the user/group (authority) via email
	}
	public void setPolicyComponent(final PolicyComponent policyComponent) {
		this.policyComponent = policyComponent;
	}

	@Override
	public void afterPropertiesSet() throws Exception {
          policyComponent.bindClassBehaviour(PermissionServicePolicies.OnGrantLocalPermission.QNAME,
		 ContentModel.TYPE_CONTENT,
		 new JavaBehaviour(this, PermissionServicePolicies.OnGrantLocalPermission.QNAME.getLocalName(),
			NotificationFrequency.EVERY_EVENT));
}&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Dec 2020 22:13:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/notify-user-with-an-email-when-user-s-granted-permission-to-see/m-p/126693#M34484</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-12-21T22:13:30Z</dc:date>
    </item>
  </channel>
</rss>

