I want to execute some code (Java if it's possible or Javascript if it isn't) when an user manages permissions in Alfresco Share and he saves changes, which is the best way to do this? I can't find a behaviour or similar to listen on this event.
Thanks in advance!
Solved! Go to Solution.
You can try using PermissionServicePolicies.
Hi @eljuaner,
Do you mean permissions on a document? If so, this tutorial on implementing custom behaviours might prove useful.
Hello, Eddie and thanks for your response, but I'm familiarized with create custom behaviours. My question is what event I can listen to trigger my behaviour when the permissions are set. I tried with OnCreateAssociationPolicy, OnCreateChildAssociationPolicy OnUpdateNodePolicy and OnUpdatePropertiesPolicy, but my behaviour is not triggered by any of them. So which policy could I use?
Thanks in advance again!
You can try using PermissionServicePolicies.
PermissionServicePolicies are NOT part of the Alfresco Public API and thus may change without warning between Alfresco releases. Also, these policies do NOT work like other policies, because their implementation has been hacked in a quick & dirty manner. You can only bind against these permissions using the node type - aspects of a node will be ignored during registered policy lookup. The OnInheritPermissionsEnabled and OnInheritPermissionsDisabled are the worst of all, as their lookup will only check for bindings against the system base type, and completely ignores any special type the node may have.
As it stands, these policies require more or less a global binding and custom type/aspect check when your behaviour implementation is being called to determine if your logic actually needs to run.
Ok, thank you both very much!
I was looking for something like those policies that you showed me, Angel. It wouldn't be the first time you saved my day.
Unfortunately, in this case my client uses an older version of Alfresco, which does not have these behaviors. This may be another reason for them to upgrade to a newer version. Anyway we have implemented one workaround to solve this particular problem.
Axel, one last thing, do you know if the PermissionServicePolicies are planned to become part of the Alfresco Public API in next releases? I think they could be useful for more people.
Thanks again and regards
I do not expect to ever see the PermissionServicePolicies as part of the public API. a) Alfresco would only include this if they have a use case of their own that warrants this, b) Alfresco is hoping to move people away from using in-process behaviours for event handling, and use queue-based out-of-process handling - adding more policy interfaces seems counter-productive for that goal.
Hi @eljuaner,
Thanks for updating. your post - helpful to others to know.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.