Export content as JSON ready to be imported

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Export content as JSON ready to be imported

Guillaume Lucazeau
Hello,

Currently when you get content through the json extension, it contains
protected properties ("jcr:created", "jcr:createdBy") and permissions nodes.

The protected properties prevent the JSON to be immediately reimported in
another repository, and for what I see here [1] permissions are not handled
by the content loader.

Is there an easy way to configure the JSON servlet to return only content
that can be imported again? Or do I have to override this servlet and
filter/remove those properties myself?

Thank you,
Guillaume

[1] http://stackoverflow.com/a/21406709/1987781
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Robert Munteanu-2
Hi Guillaume,

On Tue, 2016-11-29 at 18:36 +0100, Guillaume Lucazeau wrote:

> Hello,
>
> Currently when you get content through the json extension, it
> contains
> protected properties ("jcr:created", "jcr:createdBy") and permissions
> nodes.
>
> The protected properties prevent the JSON to be immediately
> reimported in
> another repository, and for what I see here [1] permissions are not
> handled
> by the content loader.
>
> Is there an easy way to configure the JSON servlet to return only
> content
> that can be imported again? Or do I have to override this servlet and
> filter/remove those properties myself?

Maybe a better idea would be to enhance the content loader to skip
protected properties. Not sure about ACLs though, it seems like they
should be handled by the content importer.

Robert

>
> Thank you,
> Guillaume
>
> [1] http://stackoverflow.com/a/21406709/1987781

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Guillaume Lucazeau
Hello Robert,

Is it something that would be valuable to Sling itself, or should I try to
do it just for my project?

I couldn't find a list of all protected properties in Jackrabbit, do you
know if there is one? Or maybe there is a way to dynamically know if a
property is protected

Thank you

Regards,
Guillaume

On Sat, Dec 17, 2016 at 9:18 PM, Robert Munteanu <[hidden email]> wrote:

> Hi Guillaume,
>
> On Tue, 2016-11-29 at 18:36 +0100, Guillaume Lucazeau wrote:
> > Hello,
> >
> > Currently when you get content through the json extension, it
> > contains
> > protected properties ("jcr:created", "jcr:createdBy") and permissions
> > nodes.
> >
> > The protected properties prevent the JSON to be immediately
> > reimported in
> > another repository, and for what I see here [1] permissions are not
> > handled
> > by the content loader.
> >
> > Is there an easy way to configure the JSON servlet to return only
> > content
> > that can be imported again? Or do I have to override this servlet and
> > filter/remove those properties myself?
>
> Maybe a better idea would be to enhance the content loader to skip
> protected properties. Not sure about ACLs though, it seems like they
> should be handled by the content importer.
>
> Robert
>
> >
> > Thank you,
> > Guillaume
> >
> > [1] http://stackoverflow.com/a/21406709/1987781
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Robert Munteanu-2
On Wed, 2016-12-21 at 12:30 +0100, Guillaume Lucazeau wrote:
> Hello Robert,
>
> Is it something that would be valuable to Sling itself, or should I
> try to
> do it just for my project?

Enhancements to the content loader are more than welcome in Sling :-)

> I couldn't find a list of all protected properties in Jackrabbit, do
> you
> know if there is one? Or maybe there is a way to dynamically know if
> a
> property is protected

javax.jcr.Node#getProperties() will get you a list of properties
defined on a node, and then you can use
javax.jcr.Property#getDefinition() to retrieve its definition. Finally,
 javax.jcr.nodetype.PropertyDefinition#isProtected() will let you know
if the property is protected.

Robert

>
> Thank you
>
> Regards,
> Guillaume
>
> On Sat, Dec 17, 2016 at 9:18 PM, Robert Munteanu <[hidden email]>
> wrote:
>
> > Hi Guillaume,
> >
> > On Tue, 2016-11-29 at 18:36 +0100, Guillaume Lucazeau wrote:
> > > Hello,
> > >
> > > Currently when you get content through the json extension, it
> > > contains
> > > protected properties ("jcr:created", "jcr:createdBy") and
> > > permissions
> > > nodes.
> > >
> > > The protected properties prevent the JSON to be immediately
> > > reimported in
> > > another repository, and for what I see here [1] permissions are
> > > not
> > > handled
> > > by the content loader.
> > >
> > > Is there an easy way to configure the JSON servlet to return only
> > > content
> > > that can be imported again? Or do I have to override this servlet
> > > and
> > > filter/remove those properties myself?
> >
> > Maybe a better idea would be to enhance the content loader to skip
> > protected properties. Not sure about ACLs though, it seems like
> > they
> > should be handled by the content importer.
> >
> > Robert
> >
> > >
> > > Thank you,
> > > Guillaume
> > >
> > > [1] http://stackoverflow.com/a/21406709/1987781
> >
> >

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Guillaume Lucazeau
Hello Robert,

I finally have time this week to work on those enhancements, required on
our project. How does it work, should I create tickets in Sling Jira and
put a comment saying that i'm trying to fix this?

I have a question regarding your previous answer: how will this work for
new properties? For instance, if I want to import some JSON for new nodes
containing a "jcr:created" property, those new nodes will not contain any
property and therefore I won't be able to check if "jcr:created" is
protected or not, am I right?

I have started to look at the DefaultContentCreator class in the jcr
contentloader, but any help would be useful.

Best regards,
Guillaume

On Wed, Dec 21, 2016 at 1:08 PM, Robert Munteanu <[hidden email]> wrote:

> On Wed, 2016-12-21 at 12:30 +0100, Guillaume Lucazeau wrote:
> > Hello Robert,
> >
> > Is it something that would be valuable to Sling itself, or should I
> > try to
> > do it just for my project?
>
> Enhancements to the content loader are more than welcome in Sling :-)
>
> > I couldn't find a list of all protected properties in Jackrabbit, do
> > you
> > know if there is one? Or maybe there is a way to dynamically know if
> > a
> > property is protected
>
> javax.jcr.Node#getProperties() will get you a list of properties
> defined on a node, and then you can use
> javax.jcr.Property#getDefinition() to retrieve its definition. Finally,
>  javax.jcr.nodetype.PropertyDefinition#isProtected() will let you know
> if the property is protected.
>
> Robert
>
> >
> > Thank you
> >
> > Regards,
> > Guillaume
> >
> > On Sat, Dec 17, 2016 at 9:18 PM, Robert Munteanu <[hidden email]>
> > wrote:
> >
> > > Hi Guillaume,
> > >
> > > On Tue, 2016-11-29 at 18:36 +0100, Guillaume Lucazeau wrote:
> > > > Hello,
> > > >
> > > > Currently when you get content through the json extension, it
> > > > contains
> > > > protected properties ("jcr:created", "jcr:createdBy") and
> > > > permissions
> > > > nodes.
> > > >
> > > > The protected properties prevent the JSON to be immediately
> > > > reimported in
> > > > another repository, and for what I see here [1] permissions are
> > > > not
> > > > handled
> > > > by the content loader.
> > > >
> > > > Is there an easy way to configure the JSON servlet to return only
> > > > content
> > > > that can be imported again? Or do I have to override this servlet
> > > > and
> > > > filter/remove those properties myself?
> > >
> > > Maybe a better idea would be to enhance the content loader to skip
> > > protected properties. Not sure about ACLs though, it seems like
> > > they
> > > should be handled by the content importer.
> > >
> > > Robert
> > >
> > > >
> > > > Thank you,
> > > > Guillaume
> > > >
> > > > [1] http://stackoverflow.com/a/21406709/1987781
> > >
> > >
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Robert Munteanu-2
Hi Guillaume,

On Mon, 2017-03-06 at 12:20 +0100, Guillaume Lucazeau wrote:
> Hello Robert,
>
> I finally have time this week to work on those enhancements, required
> on
> our project. How does it work, should I create tickets in Sling Jira
> and
> put a comment saying that i'm trying to fix this?

Yup, sounds like a good idea.

>
> I have a question regarding your previous answer: how will this work
> for
> new properties? For instance, if I want to import some JSON for new
> nodes
> containing a "jcr:created" property, those new nodes will not contain
> any
> property and therefore I won't be able to check if "jcr:created" is
> protected or not, am I right?

You should be able to get more information by accessing the node's
primary/mixin node types and node definition.

Robert

>
> I have started to look at the DefaultContentCreator class in the jcr
> contentloader, but any help would be useful.
>
> Best regards,
> Guillaume
>
> On Wed, Dec 21, 2016 at 1:08 PM, Robert Munteanu <[hidden email]>
> wrote:
>
> > On Wed, 2016-12-21 at 12:30 +0100, Guillaume Lucazeau wrote:
> > > Hello Robert,
> > >
> > > Is it something that would be valuable to Sling itself, or should
> > > I
> > > try to
> > > do it just for my project?
> >
> > Enhancements to the content loader are more than welcome in Sling
> > :-)
> >
> > > I couldn't find a list of all protected properties in Jackrabbit,
> > > do
> > > you
> > > know if there is one? Or maybe there is a way to dynamically know
> > > if
> > > a
> > > property is protected
> >
> > javax.jcr.Node#getProperties() will get you a list of properties
> > defined on a node, and then you can use
> > javax.jcr.Property#getDefinition() to retrieve its definition.
> > Finally,
> >  javax.jcr.nodetype.PropertyDefinition#isProtected() will let you
> > know
> > if the property is protected.
> >
> > Robert
> >
> > >
> > > Thank you
> > >
> > > Regards,
> > > Guillaume
> > >
> > > On Sat, Dec 17, 2016 at 9:18 PM, Robert Munteanu <rombert@apache.
> > > org>
> > > wrote:
> > >
> > > > Hi Guillaume,
> > > >
> > > > On Tue, 2016-11-29 at 18:36 +0100, Guillaume Lucazeau wrote:
> > > > > Hello,
> > > > >
> > > > > Currently when you get content through the json extension, it
> > > > > contains
> > > > > protected properties ("jcr:created", "jcr:createdBy") and
> > > > > permissions
> > > > > nodes.
> > > > >
> > > > > The protected properties prevent the JSON to be immediately
> > > > > reimported in
> > > > > another repository, and for what I see here [1] permissions
> > > > > are
> > > > > not
> > > > > handled
> > > > > by the content loader.
> > > > >
> > > > > Is there an easy way to configure the JSON servlet to return
> > > > > only
> > > > > content
> > > > > that can be imported again? Or do I have to override this
> > > > > servlet
> > > > > and
> > > > > filter/remove those properties myself?
> > > >
> > > > Maybe a better idea would be to enhance the content loader to
> > > > skip
> > > > protected properties. Not sure about ACLs though, it seems like
> > > > they
> > > > should be handled by the content importer.
> > > >
> > > > Robert
> > > >
> > > > >
> > > > > Thank you,
> > > > > Guillaume
> > > > >
> > > > > [1] http://stackoverflow.com/a/21406709/1987781
> > > >
> > > >
> >
> >

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Guillaume Lucazeau
I have created this ticket, for protected properties and nodes:
https://issues.apache.org/jira/browse/SLING-6614

I have realized after my previous e-mail that autocreated properties would
actually be there after node creation and that I could check their
protected status. I have created this PR:
https://github.com/apache/sling/pull/201 if you want to have a look. It
works with my content export, but I am not sure it covers all the cases.

I will probably have more questions about ACLs and the content importer.

Thank you,
Guillaume

On Mon, Mar 6, 2017 at 5:03 PM, Robert Munteanu <[hidden email]> wrote:

> Hi Guillaume,
>
> On Mon, 2017-03-06 at 12:20 +0100, Guillaume Lucazeau wrote:
> > Hello Robert,
> >
> > I finally have time this week to work on those enhancements, required
> > on
> > our project. How does it work, should I create tickets in Sling Jira
> > and
> > put a comment saying that i'm trying to fix this?
>
> Yup, sounds like a good idea.
>
> >
> > I have a question regarding your previous answer: how will this work
> > for
> > new properties? For instance, if I want to import some JSON for new
> > nodes
> > containing a "jcr:created" property, those new nodes will not contain
> > any
> > property and therefore I won't be able to check if "jcr:created" is
> > protected or not, am I right?
>
> You should be able to get more information by accessing the node's
> primary/mixin node types and node definition.
>
> Robert
>
> >
> > I have started to look at the DefaultContentCreator class in the jcr
> > contentloader, but any help would be useful.
> >
> > Best regards,
> > Guillaume
> >
> > On Wed, Dec 21, 2016 at 1:08 PM, Robert Munteanu <[hidden email]>
> > wrote:
> >
> > > On Wed, 2016-12-21 at 12:30 +0100, Guillaume Lucazeau wrote:
> > > > Hello Robert,
> > > >
> > > > Is it something that would be valuable to Sling itself, or should
> > > > I
> > > > try to
> > > > do it just for my project?
> > >
> > > Enhancements to the content loader are more than welcome in Sling
> > > :-)
> > >
> > > > I couldn't find a list of all protected properties in Jackrabbit,
> > > > do
> > > > you
> > > > know if there is one? Or maybe there is a way to dynamically know
> > > > if
> > > > a
> > > > property is protected
> > >
> > > javax.jcr.Node#getProperties() will get you a list of properties
> > > defined on a node, and then you can use
> > > javax.jcr.Property#getDefinition() to retrieve its definition.
> > > Finally,
> > >  javax.jcr.nodetype.PropertyDefinition#isProtected() will let you
> > > know
> > > if the property is protected.
> > >
> > > Robert
> > >
> > > >
> > > > Thank you
> > > >
> > > > Regards,
> > > > Guillaume
> > > >
> > > > On Sat, Dec 17, 2016 at 9:18 PM, Robert Munteanu <rombert@apache.
> > > > org>
> > > > wrote:
> > > >
> > > > > Hi Guillaume,
> > > > >
> > > > > On Tue, 2016-11-29 at 18:36 +0100, Guillaume Lucazeau wrote:
> > > > > > Hello,
> > > > > >
> > > > > > Currently when you get content through the json extension, it
> > > > > > contains
> > > > > > protected properties ("jcr:created", "jcr:createdBy") and
> > > > > > permissions
> > > > > > nodes.
> > > > > >
> > > > > > The protected properties prevent the JSON to be immediately
> > > > > > reimported in
> > > > > > another repository, and for what I see here [1] permissions
> > > > > > are
> > > > > > not
> > > > > > handled
> > > > > > by the content loader.
> > > > > >
> > > > > > Is there an easy way to configure the JSON servlet to return
> > > > > > only
> > > > > > content
> > > > > > that can be imported again? Or do I have to override this
> > > > > > servlet
> > > > > > and
> > > > > > filter/remove those properties myself?
> > > > >
> > > > > Maybe a better idea would be to enhance the content loader to
> > > > > skip
> > > > > protected properties. Not sure about ACLs though, it seems like
> > > > > they
> > > > > should be handled by the content importer.
> > > > >
> > > > > Robert
> > > > >
> > > > > >
> > > > > > Thank you,
> > > > > > Guillaume
> > > > > >
> > > > > > [1] http://stackoverflow.com/a/21406709/1987781
> > > > >
> > > > >
> > >
> > >
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Guillaume Lucazeau
Hello,

I'm having troubles finding where I should handle ACLs nodes. In your first
e-mail you said
> Not sure about ACLs though, it seems like they should be handled by the
content importer.

From what I see the content importer is the main entry point for content
import and is handling JSON or XML content, content that can contain actual
nodes and ACLs nodes. Therefore, I don't really understand how I could What
did you have in mind?
From my understanding, the DefaultContentCreator would have to be able to
create ACLs node and properties.

Any advice or suggestion on how to implement ACLs imports would be really
helpful.

Is that something already available in Adobe products built on top of Sling?

Thank you very much for your help.

Best regards,
Guillaume


On Mon, Mar 6, 2017 at 5:39 PM, Guillaume Lucazeau <[hidden email]>
wrote:

> I have created this ticket, for protected properties and nodes:
> https://issues.apache.org/jira/browse/SLING-6614
>
> I have realized after my previous e-mail that autocreated properties would
> actually be there after node creation and that I could check their
> protected status. I have created this PR: https://github.com/apache/
> sling/pull/201 if you want to have a look. It works with my content
> export, but I am not sure it covers all the cases.
>
> I will probably have more questions about ACLs and the content importer.
>
> Thank you,
> Guillaume
>
> On Mon, Mar 6, 2017 at 5:03 PM, Robert Munteanu <[hidden email]>
> wrote:
>
>> Hi Guillaume,
>>
>> On Mon, 2017-03-06 at 12:20 +0100, Guillaume Lucazeau wrote:
>> > Hello Robert,
>> >
>> > I finally have time this week to work on those enhancements, required
>> > on
>> > our project. How does it work, should I create tickets in Sling Jira
>> > and
>> > put a comment saying that i'm trying to fix this?
>>
>> Yup, sounds like a good idea.
>>
>> >
>> > I have a question regarding your previous answer: how will this work
>> > for
>> > new properties? For instance, if I want to import some JSON for new
>> > nodes
>> > containing a "jcr:created" property, those new nodes will not contain
>> > any
>> > property and therefore I won't be able to check if "jcr:created" is
>> > protected or not, am I right?
>>
>> You should be able to get more information by accessing the node's
>> primary/mixin node types and node definition.
>>
>> Robert
>>
>> >
>> > I have started to look at the DefaultContentCreator class in the jcr
>> > contentloader, but any help would be useful.
>> >
>> > Best regards,
>> > Guillaume
>> >
>> > On Wed, Dec 21, 2016 at 1:08 PM, Robert Munteanu <[hidden email]>
>> > wrote:
>> >
>> > > On Wed, 2016-12-21 at 12:30 +0100, Guillaume Lucazeau wrote:
>> > > > Hello Robert,
>> > > >
>> > > > Is it something that would be valuable to Sling itself, or should
>> > > > I
>> > > > try to
>> > > > do it just for my project?
>> > >
>> > > Enhancements to the content loader are more than welcome in Sling
>> > > :-)
>> > >
>> > > > I couldn't find a list of all protected properties in Jackrabbit,
>> > > > do
>> > > > you
>> > > > know if there is one? Or maybe there is a way to dynamically know
>> > > > if
>> > > > a
>> > > > property is protected
>> > >
>> > > javax.jcr.Node#getProperties() will get you a list of properties
>> > > defined on a node, and then you can use
>> > > javax.jcr.Property#getDefinition() to retrieve its definition.
>> > > Finally,
>> > >  javax.jcr.nodetype.PropertyDefinition#isProtected() will let you
>> > > know
>> > > if the property is protected.
>> > >
>> > > Robert
>> > >
>> > > >
>> > > > Thank you
>> > > >
>> > > > Regards,
>> > > > Guillaume
>> > > >
>> > > > On Sat, Dec 17, 2016 at 9:18 PM, Robert Munteanu <rombert@apache.
>> > > > org>
>> > > > wrote:
>> > > >
>> > > > > Hi Guillaume,
>> > > > >
>> > > > > On Tue, 2016-11-29 at 18:36 +0100, Guillaume Lucazeau wrote:
>> > > > > > Hello,
>> > > > > >
>> > > > > > Currently when you get content through the json extension, it
>> > > > > > contains
>> > > > > > protected properties ("jcr:created", "jcr:createdBy") and
>> > > > > > permissions
>> > > > > > nodes.
>> > > > > >
>> > > > > > The protected properties prevent the JSON to be immediately
>> > > > > > reimported in
>> > > > > > another repository, and for what I see here [1] permissions
>> > > > > > are
>> > > > > > not
>> > > > > > handled
>> > > > > > by the content loader.
>> > > > > >
>> > > > > > Is there an easy way to configure the JSON servlet to return
>> > > > > > only
>> > > > > > content
>> > > > > > that can be imported again? Or do I have to override this
>> > > > > > servlet
>> > > > > > and
>> > > > > > filter/remove those properties myself?
>> > > > >
>> > > > > Maybe a better idea would be to enhance the content loader to
>> > > > > skip
>> > > > > protected properties. Not sure about ACLs though, it seems like
>> > > > > they
>> > > > > should be handled by the content importer.
>> > > > >
>> > > > > Robert
>> > > > >
>> > > > > >
>> > > > > > Thank you,
>> > > > > > Guillaume
>> > > > > >
>> > > > > > [1] http://stackoverflow.com/a/21406709/1987781
>> > > > >
>> > > > >
>> > >
>> > >
>>
>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Guillaume Lucazeau
Hello,

I realized that when getting some content as JSON from the basic servlet, I
sometimes get the ACLs nodes. But this only happens in some environment,
not on my local environment nor with a simple Sling standalone jar.

Can you confirm that I shouldn't get ACLs nodes when getting content as
JSON?

Because that's why I asked how to handled those nodes during JSON import,
but I may have been mistaken by an unusual situation.

Thank you,
Guillaume

2017-03-07 11:15 GMT+01:00 Guillaume Lucazeau <[hidden email]>:

> Hello,
>
> I'm having troubles finding where I should handle ACLs nodes. In your
> first e-mail you said
> > Not sure about ACLs though, it seems like they should be handled by the
> content importer.
>
> From what I see the content importer is the main entry point for content
> import and is handling JSON or XML content, content that can contain actual
> nodes and ACLs nodes. Therefore, I don't really understand how I could What
> did you have in mind?
> From my understanding, the DefaultContentCreator would have to be able to
> create ACLs node and properties.
>
> Any advice or suggestion on how to implement ACLs imports would be really
> helpful.
>
> Is that something already available in Adobe products built on top of
> Sling?
>
> Thank you very much for your help.
>
> Best regards,
> Guillaume
>
>
> On Mon, Mar 6, 2017 at 5:39 PM, Guillaume Lucazeau <[hidden email]>
> wrote:
>
>> I have created this ticket, for protected properties and nodes:
>> https://issues.apache.org/jira/browse/SLING-6614
>>
>> I have realized after my previous e-mail that autocreated properties
>> would actually be there after node creation and that I could check their
>> protected status. I have created this PR: https://github.com/apache/slin
>> g/pull/201 if you want to have a look. It works with my content export,
>> but I am not sure it covers all the cases.
>>
>> I will probably have more questions about ACLs and the content importer.
>>
>> Thank you,
>> Guillaume
>>
>> On Mon, Mar 6, 2017 at 5:03 PM, Robert Munteanu <[hidden email]>
>> wrote:
>>
>>> Hi Guillaume,
>>>
>>> On Mon, 2017-03-06 at 12:20 +0100, Guillaume Lucazeau wrote:
>>> > Hello Robert,
>>> >
>>> > I finally have time this week to work on those enhancements, required
>>> > on
>>> > our project. How does it work, should I create tickets in Sling Jira
>>> > and
>>> > put a comment saying that i'm trying to fix this?
>>>
>>> Yup, sounds like a good idea.
>>>
>>> >
>>> > I have a question regarding your previous answer: how will this work
>>> > for
>>> > new properties? For instance, if I want to import some JSON for new
>>> > nodes
>>> > containing a "jcr:created" property, those new nodes will not contain
>>> > any
>>> > property and therefore I won't be able to check if "jcr:created" is
>>> > protected or not, am I right?
>>>
>>> You should be able to get more information by accessing the node's
>>> primary/mixin node types and node definition.
>>>
>>> Robert
>>>
>>> >
>>> > I have started to look at the DefaultContentCreator class in the jcr
>>> > contentloader, but any help would be useful.
>>> >
>>> > Best regards,
>>> > Guillaume
>>> >
>>> > On Wed, Dec 21, 2016 at 1:08 PM, Robert Munteanu <[hidden email]>
>>> > wrote:
>>> >
>>> > > On Wed, 2016-12-21 at 12:30 +0100, Guillaume Lucazeau wrote:
>>> > > > Hello Robert,
>>> > > >
>>> > > > Is it something that would be valuable to Sling itself, or should
>>> > > > I
>>> > > > try to
>>> > > > do it just for my project?
>>> > >
>>> > > Enhancements to the content loader are more than welcome in Sling
>>> > > :-)
>>> > >
>>> > > > I couldn't find a list of all protected properties in Jackrabbit,
>>> > > > do
>>> > > > you
>>> > > > know if there is one? Or maybe there is a way to dynamically know
>>> > > > if
>>> > > > a
>>> > > > property is protected
>>> > >
>>> > > javax.jcr.Node#getProperties() will get you a list of properties
>>> > > defined on a node, and then you can use
>>> > > javax.jcr.Property#getDefinition() to retrieve its definition.
>>> > > Finally,
>>> > >  javax.jcr.nodetype.PropertyDefinition#isProtected() will let you
>>> > > know
>>> > > if the property is protected.
>>> > >
>>> > > Robert
>>> > >
>>> > > >
>>> > > > Thank you
>>> > > >
>>> > > > Regards,
>>> > > > Guillaume
>>> > > >
>>> > > > On Sat, Dec 17, 2016 at 9:18 PM, Robert Munteanu <rombert@apache.
>>> > > > org>
>>> > > > wrote:
>>> > > >
>>> > > > > Hi Guillaume,
>>> > > > >
>>> > > > > On Tue, 2016-11-29 at 18:36 +0100, Guillaume Lucazeau wrote:
>>> > > > > > Hello,
>>> > > > > >
>>> > > > > > Currently when you get content through the json extension, it
>>> > > > > > contains
>>> > > > > > protected properties ("jcr:created", "jcr:createdBy") and
>>> > > > > > permissions
>>> > > > > > nodes.
>>> > > > > >
>>> > > > > > The protected properties prevent the JSON to be immediately
>>> > > > > > reimported in
>>> > > > > > another repository, and for what I see here [1] permissions
>>> > > > > > are
>>> > > > > > not
>>> > > > > > handled
>>> > > > > > by the content loader.
>>> > > > > >
>>> > > > > > Is there an easy way to configure the JSON servlet to return
>>> > > > > > only
>>> > > > > > content
>>> > > > > > that can be imported again? Or do I have to override this
>>> > > > > > servlet
>>> > > > > > and
>>> > > > > > filter/remove those properties myself?
>>> > > > >
>>> > > > > Maybe a better idea would be to enhance the content loader to
>>> > > > > skip
>>> > > > > protected properties. Not sure about ACLs though, it seems like
>>> > > > > they
>>> > > > > should be handled by the content importer.
>>> > > > >
>>> > > > > Robert
>>> > > > >
>>> > > > > >
>>> > > > > > Thank you,
>>> > > > > > Guillaume
>>> > > > > >
>>> > > > > > [1] http://stackoverflow.com/a/21406709/1987781
>>> > > > >
>>> > > > >
>>> > >
>>> > >
>>>
>>>
>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Guillaume Lucazeau
Hello,

So I've realized my previous question was dumb, ACLs always get returned
when you provide a depth to the JSON servlet...

Considering the lack of responses, Re-importing exported JSON, including
the priviliges, doesn't seem to be a feature that lots of people need, so I
will try to patch the importer on my own :)

I was wondering if pull requests on Github are the best way to submit
patches to Sling, or if you prefer diff files attached to a ticket.

Thank you,
Guillaume

2017-03-20 11:50 GMT+01:00 Guillaume Lucazeau <[hidden email]>:

> Hello,
>
> I realized that when getting some content as JSON from the basic servlet,
> I sometimes get the ACLs nodes. But this only happens in some environment,
> not on my local environment nor with a simple Sling standalone jar.
>
> Can you confirm that I shouldn't get ACLs nodes when getting content as
> JSON?
>
> Because that's why I asked how to handled those nodes during JSON import,
> but I may have been mistaken by an unusual situation.
>
> Thank you,
> Guillaume
>
> 2017-03-07 11:15 GMT+01:00 Guillaume Lucazeau <[hidden email]>:
>
>> Hello,
>>
>> I'm having troubles finding where I should handle ACLs nodes. In your
>> first e-mail you said
>> > Not sure about ACLs though, it seems like they should be handled by the
>> content importer.
>>
>> From what I see the content importer is the main entry point for content
>> import and is handling JSON or XML content, content that can contain actual
>> nodes and ACLs nodes. Therefore, I don't really understand how I could What
>> did you have in mind?
>> From my understanding, the DefaultContentCreator would have to be able to
>> create ACLs node and properties.
>>
>> Any advice or suggestion on how to implement ACLs imports would be really
>> helpful.
>>
>> Is that something already available in Adobe products built on top of
>> Sling?
>>
>> Thank you very much for your help.
>>
>> Best regards,
>> Guillaume
>>
>>
>> On Mon, Mar 6, 2017 at 5:39 PM, Guillaume Lucazeau <[hidden email]>
>> wrote:
>>
>>> I have created this ticket, for protected properties and nodes:
>>> https://issues.apache.org/jira/browse/SLING-6614
>>>
>>> I have realized after my previous e-mail that autocreated properties
>>> would actually be there after node creation and that I could check their
>>> protected status. I have created this PR: https://github.com/apache/slin
>>> g/pull/201 if you want to have a look. It works with my content export,
>>> but I am not sure it covers all the cases.
>>>
>>> I will probably have more questions about ACLs and the content importer.
>>>
>>> Thank you,
>>> Guillaume
>>>
>>> On Mon, Mar 6, 2017 at 5:03 PM, Robert Munteanu <[hidden email]>
>>> wrote:
>>>
>>>> Hi Guillaume,
>>>>
>>>> On Mon, 2017-03-06 at 12:20 +0100, Guillaume Lucazeau wrote:
>>>> > Hello Robert,
>>>> >
>>>> > I finally have time this week to work on those enhancements, required
>>>> > on
>>>> > our project. How does it work, should I create tickets in Sling Jira
>>>> > and
>>>> > put a comment saying that i'm trying to fix this?
>>>>
>>>> Yup, sounds like a good idea.
>>>>
>>>> >
>>>> > I have a question regarding your previous answer: how will this work
>>>> > for
>>>> > new properties? For instance, if I want to import some JSON for new
>>>> > nodes
>>>> > containing a "jcr:created" property, those new nodes will not contain
>>>> > any
>>>> > property and therefore I won't be able to check if "jcr:created" is
>>>> > protected or not, am I right?
>>>>
>>>> You should be able to get more information by accessing the node's
>>>> primary/mixin node types and node definition.
>>>>
>>>> Robert
>>>>
>>>> >
>>>> > I have started to look at the DefaultContentCreator class in the jcr
>>>> > contentloader, but any help would be useful.
>>>> >
>>>> > Best regards,
>>>> > Guillaume
>>>> >
>>>> > On Wed, Dec 21, 2016 at 1:08 PM, Robert Munteanu <[hidden email]>
>>>> > wrote:
>>>> >
>>>> > > On Wed, 2016-12-21 at 12:30 +0100, Guillaume Lucazeau wrote:
>>>> > > > Hello Robert,
>>>> > > >
>>>> > > > Is it something that would be valuable to Sling itself, or should
>>>> > > > I
>>>> > > > try to
>>>> > > > do it just for my project?
>>>> > >
>>>> > > Enhancements to the content loader are more than welcome in Sling
>>>> > > :-)
>>>> > >
>>>> > > > I couldn't find a list of all protected properties in Jackrabbit,
>>>> > > > do
>>>> > > > you
>>>> > > > know if there is one? Or maybe there is a way to dynamically know
>>>> > > > if
>>>> > > > a
>>>> > > > property is protected
>>>> > >
>>>> > > javax.jcr.Node#getProperties() will get you a list of properties
>>>> > > defined on a node, and then you can use
>>>> > > javax.jcr.Property#getDefinition() to retrieve its definition.
>>>> > > Finally,
>>>> > >  javax.jcr.nodetype.PropertyDefinition#isProtected() will let you
>>>> > > know
>>>> > > if the property is protected.
>>>> > >
>>>> > > Robert
>>>> > >
>>>> > > >
>>>> > > > Thank you
>>>> > > >
>>>> > > > Regards,
>>>> > > > Guillaume
>>>> > > >
>>>> > > > On Sat, Dec 17, 2016 at 9:18 PM, Robert Munteanu <rombert@apache.
>>>> > > > org>
>>>> > > > wrote:
>>>> > > >
>>>> > > > > Hi Guillaume,
>>>> > > > >
>>>> > > > > On Tue, 2016-11-29 at 18:36 +0100, Guillaume Lucazeau wrote:
>>>> > > > > > Hello,
>>>> > > > > >
>>>> > > > > > Currently when you get content through the json extension, it
>>>> > > > > > contains
>>>> > > > > > protected properties ("jcr:created", "jcr:createdBy") and
>>>> > > > > > permissions
>>>> > > > > > nodes.
>>>> > > > > >
>>>> > > > > > The protected properties prevent the JSON to be immediately
>>>> > > > > > reimported in
>>>> > > > > > another repository, and for what I see here [1] permissions
>>>> > > > > > are
>>>> > > > > > not
>>>> > > > > > handled
>>>> > > > > > by the content loader.
>>>> > > > > >
>>>> > > > > > Is there an easy way to configure the JSON servlet to return
>>>> > > > > > only
>>>> > > > > > content
>>>> > > > > > that can be imported again? Or do I have to override this
>>>> > > > > > servlet
>>>> > > > > > and
>>>> > > > > > filter/remove those properties myself?
>>>> > > > >
>>>> > > > > Maybe a better idea would be to enhance the content loader to
>>>> > > > > skip
>>>> > > > > protected properties. Not sure about ACLs though, it seems like
>>>> > > > > they
>>>> > > > > should be handled by the content importer.
>>>> > > > >
>>>> > > > > Robert
>>>> > > > >
>>>> > > > > >
>>>> > > > > > Thank you,
>>>> > > > > > Guillaume
>>>> > > > > >
>>>> > > > > > [1] http://stackoverflow.com/a/21406709/1987781
>>>> > > > >
>>>> > > > >
>>>> > >
>>>> > >
>>>>
>>>>
>>>
>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Bertrand Delacretaz
Hi,

On Tue, Mar 28, 2017 at 11:25 AM, Guillaume Lucazeau
<[hidden email]> wrote:
> ...Considering the lack of responses, Re-importing exported JSON, including
> the priviliges, doesn't seem to be a feature that lots of people need, so I
> will try to patch the importer on my own :)..

I actually have a use case for this on my list, but that's a long list
so I'm not sure when I'll start working on it.

> ...I was wondering if pull requests on Github are the best way to submit
> patches to Sling, or if you prefer diff files attached to a ticket...

We need a jira ticket in any case, but submitting patches as pull
requests works.

Looking forward to your contributions!

(and don't forget the tests ;-)

-Bertrand
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Guillaume Lucazeau
Hello Bertrand,

Thank you for your reply. I have created SLING-6738 for the ACLs import.

Before adding unit tests and sending a PR, I would like to know if I'm
going in the right direction.

I've seen that in JsonReader there are already createAce and createAcl
methods, but they are used to create ACLs from the acl.json servlet.

So, I've modified the handleSecurity method, and if the node is named
"rep:policy", I call my own method "createAceFromPolicy". This method just
loops on the subnodes of a "rep:policy" node (i.e. keys starting with
"allow" or "deny", gather all information and calls
contentCreator.createAce.

It works fine for my case, but I would be curious to have some feedback and
make sure I didn't forget anything. At the beginning of the discussion
Robert was talking about editing the content importer, but I couldn't find
how I was suppose to do that.

Also, I would like to know if the order of the ACE is important. As there
is no order property on the JSON returned by the content servlet, and has
JSON is not ordered, I'm not able so far to keep the original order.

Thank you for your help,

Guillaume

2017-03-28 11:56 GMT+02:00 Bertrand Delacretaz <[hidden email]>:

> Hi,
>
> On Tue, Mar 28, 2017 at 11:25 AM, Guillaume Lucazeau
> <[hidden email]> wrote:
> > ...Considering the lack of responses, Re-importing exported JSON,
> including
> > the priviliges, doesn't seem to be a feature that lots of people need,
> so I
> > will try to patch the importer on my own :)..
>
> I actually have a use case for this on my list, but that's a long list
> so I'm not sure when I'll start working on it.
>
> > ...I was wondering if pull requests on Github are the best way to submit
> > patches to Sling, or if you prefer diff files attached to a ticket...
>
> We need a jira ticket in any case, but submitting patches as pull
> requests works.
>
> Looking forward to your contributions!
>
> (and don't forget the tests ;-)
>
> -Bertrand
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Export content as JSON ready to be imported

Julian Sedding-3
Hi Guillaume

AFAIK Jackrabbit FileVault uses a similar approach. I'm not super
familiar with the code, but you may find interesting details if you
look at the classes JackrabbitACLImporter[0] and/or
JcrACLManagement[1].

The order of ACEs is significant. IIRC later entries "override"
earlier ones (provided the principal matches). However, an ACE for a
principal representing a user always is "stronger" than one
representing a group (not really your concern when importing though).

Further reading regarding access control[2] can be found on the
Jackrabbit Oak website.

Regards
Julian

[0] https://github.com/apache/jackrabbit-filevault/blob/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/JackrabbitACLImporter.java
[1] https://github.com/apache/jackrabbit-filevault/blob/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/spi/impl/jcr20/JcrACLManagement.java
[2] http://jackrabbit.apache.org/oak/docs/security/accesscontrol.html

On Tue, Mar 28, 2017 at 4:32 PM, Guillaume Lucazeau <[hidden email]> wrote:

> Hello Bertrand,
>
> Thank you for your reply. I have created SLING-6738 for the ACLs import.
>
> Before adding unit tests and sending a PR, I would like to know if I'm
> going in the right direction.
>
> I've seen that in JsonReader there are already createAce and createAcl
> methods, but they are used to create ACLs from the acl.json servlet.
>
> So, I've modified the handleSecurity method, and if the node is named
> "rep:policy", I call my own method "createAceFromPolicy". This method just
> loops on the subnodes of a "rep:policy" node (i.e. keys starting with
> "allow" or "deny", gather all information and calls
> contentCreator.createAce.
>
> It works fine for my case, but I would be curious to have some feedback and
> make sure I didn't forget anything. At the beginning of the discussion
> Robert was talking about editing the content importer, but I couldn't find
> how I was suppose to do that.
>
> Also, I would like to know if the order of the ACE is important. As there
> is no order property on the JSON returned by the content servlet, and has
> JSON is not ordered, I'm not able so far to keep the original order.
>
> Thank you for your help,
>
> Guillaume
>
> 2017-03-28 11:56 GMT+02:00 Bertrand Delacretaz <[hidden email]>:
>
>> Hi,
>>
>> On Tue, Mar 28, 2017 at 11:25 AM, Guillaume Lucazeau
>> <[hidden email]> wrote:
>> > ...Considering the lack of responses, Re-importing exported JSON,
>> including
>> > the priviliges, doesn't seem to be a feature that lots of people need,
>> so I
>> > will try to patch the importer on my own :)..
>>
>> I actually have a use case for this on my list, but that's a long list
>> so I'm not sure when I'll start working on it.
>>
>> > ...I was wondering if pull requests on Github are the best way to submit
>> > patches to Sling, or if you prefer diff files attached to a ticket...
>>
>> We need a jira ticket in any case, but submitting patches as pull
>> requests works.
>>
>> Looking forward to your contributions!
>>
>> (and don't forget the tests ;-)
>>
>> -Bertrand
>>
Loading...