Skip to main content
rama_krishna11
Level 2
Oct 16, 2015 2:28 AM UTC
Solved

Need to reset page properties when copied page using siteadmin or sidekick or crxde

Actually for this I have created event handler. Using page event modifications able to reset page properties. When we copy page, that time page event treated as "Page Created". But "Page Created" event triggered by 3 ways.

1. copy page 2. create new page 3. install new content using package manager

my requirement don't want to work for 3rd point(install new content using package manager)

Or any better approach for copy event.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
joerghoh
joerghohAccepted solution
Adobe Employee
Oct 16, 2015 2:28 AM UTC

Hi,

I don't think, that this is possible that easy. Because on a Sling or JCR event handle you only see the effect of the activity: a new page is being created. The only way to achieve this is to intercept the commands given on the UI (and disallow the use of CRXDE for authors!) and change the target page accordingly. You could this with a filter, which checks if this request is a relevant one you need to handle and then react accordingly.

But I think, that you take the wrong route. Is it possible to handle the occurrence of a duplicate on a certain property? Or maybe revisiting the whole requirement, as it looks a bit strange for me.

Jörg

15 replies

rama_krishna11
Level 2
Oct 16, 2015 2:28 AM UTC

If it is particular user, we can do but in my project some specific group of users having all permissions. he can do installation , copy from site admin and side kick. That is the problem i am facing.

Translate
joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
Oct 16, 2015 2:28 AM UTC

Hi,

I don't think, that this is possible that easy. Because on a Sling or JCR event handle you only see the effect of the activity: a new page is being created. The only way to achieve this is to intercept the commands given on the UI (and disallow the use of CRXDE for authors!) and change the target page accordingly. You could this with a filter, which checks if this request is a relevant one you need to handle and then react accordingly.

But I think, that you take the wrong route. Is it possible to handle the occurrence of a duplicate on a certain property? Or maybe revisiting the whole requirement, as it looks a bit strange for me.

Jörg

Translate
Kunal_Gaba_
New Member
Oct 16, 2015 2:28 AM UTC

If you have to use event handler approach then one possible solution could be to create a special user for building and installing packages. This user should only be used only for installing packages and nothing else. And then in your event handler code you can check the value of for "jcr:createdBy" property. If it matches the user name of the package installation user then you can skip the reset logic.

Note - This solution will work but will require some governance as you are assuming that only a particular user account is used for installing packages. 

Translate
smacdonald2008
Level 10
Oct 16, 2015 2:28 AM UTC

Using an Event Handler for this use case is good idea.  From your requirement - you do not want this handler to fire when content is updated by package manager right?  

Translate
rama_krishna11
Level 2
Oct 19, 2015 9:08 AM UTC

Thanks to all

Translate