12-21-2020 03:43 PM
Hello,
is there a way to notify users with an email when user's granted permission to see a file.
Thanks in advance.
12-21-2020 05:13 PM
Nothing ootb, however you can implement a custom behavior using PermissionServicePolicies.
org.alfresco.repo.security.permissions.PermissionServicePolicies
org.alfresco.repo.security.permissions.PermissionServicePolicies.OnGrantLocalPermission
You must be using alfresco version 5.2.g and above in order to use PermissionServicePolicies , this class was not available before alfresco 5.2.g if i remember correctly.
Example:
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)); }
Explore our Alfresco products with the links below. Use labels to filter content by product module.