ramya_reddy
ramya_reddy
06-02-2018
Hi,
We have a requirement to implement a trash can layer for AEM Assets. This needs to be functional from both Touch UI and AEM Desktop App.
When users delete any assets(either from Touch UI or Desktop App), assets should be moved to a trash layer/folder in DAM(Copy to trash layer and delete asset in the current location). Our DAM users have delete permissions given on all asset folders.
Is there any recommended way to achieve this for both Touch UI and Desktop App? Appreciate your help!
Thanks,
Ramya
Jörg_Hoh
Employee
Jörg_Hoh
Employee
07-02-2018
Hi,
as Scott already mentioned that's something one would implement as workflow and use the Sling API to move the resource tree of the asset to a different location.
On the other hand be aware that there might be versions already available for an asset, so technically you could use this versioning information to restore the asset if needed. That's probably a bit harder to implement (you don't have a specific "trash" folder etc) but something to consider.
Jörg
ramya_reddy
ramya_reddy
07-02-2018
Hi Jörg & smacdonald2008,
I used a workflow launcher to trigger a custom workflow process for 'Remove' event type on dam:Asset type, to copy the asset to the trash folder. But by the time this workflow process is executed, the asset is already deleted and I am getting a null pointer exception.
I guess there would be a similar error if I use an event listener.
Am I missing something?
Thanks for your help!
Ramya
smacdonald2008
smacdonald2008
07-02-2018
Post a pic of your workflow model. Lets see if he can help improve it.
ramya_reddy
ramya_reddy
08-02-2018
Hi smacdonald2008,
Here are the worklfow launcher and workflow modal created. The workflow modal includes a process step which does copy of asset to trash folder in DAM. This workflow is triggered when any DAM users delete any assets in the DAM. The issue is that the assets gets deleted already before it is copied to the trash folder, since this workflow is triggered on Remove event type. Is there any other way to overcome this issue?
Thanks,
Ramya
smacdonald2008
smacdonald2008
08-02-2018
You need to redefine the Model. Make the model something like this:
1- Move Asset
2- Delete Asset
That way - the asset will be there when step 1 moves it. Run the WF on the Asset --
Jörg_Hoh
Employee
Jörg_Hoh
Employee
08-02-2018
The problem is that the workflow is triggered after the asset has been already removed. At that time it simply does not exist anymore.
You cannot rely on the workflow trigger, but you need to activly trigger the workflow (instead of just deleting the asset). The easiest way is to remove the "delete" privilege for all users and change the "request for deletion" to your needs.
Jörg
smacdonald2008
smacdonald2008
08-02-2018
I am going to code this in a WF - if you want to move the asset to another folder (maybe a copy of the asset). Then delete the original in the workflow.
ramya_reddy
ramya_reddy
08-02-2018
Hi Jörg,
Thanks for your inputs! The issue is we cannot deny delete permissions on assets for these DAM users, since that would restrict lot of other Assets functionality for them(like deleting comments, share link, relate/unrelate etc).
We are expecting that when the users delete assets (either from UI or Desktop App), they should be moved to a trash folder. Handling this from the UI can probably be done by customizing the Delete button. But this seems to be a challenge when users use Desktop app to delete any assets.
Can we overlay the OOTB Delete servlet to achieve this?
Thanks,
Ramya
smacdonald2008
smacdonald2008
08-02-2018
The solution is a workflow - step A for the payload - make a copy and move it the Trash folder and Step B is to delete the original payload. There is no need to modify the Delete button - not even sure how you would do that.
Therefore you would have your users run the workflow on the Asset when they want to delete it.