You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by jorgeeflorez <jo...@gmail.com> on 2021/02/11 19:37:01 UTC

User created date property

Hi,
I need to put and use additional properties on users and so far no problems
with those properties. I could even add a mixin to the node that represents
the user! (I am not sure if this is allowed).

It seems that the "jcr:created" property cannot be seen using
Authorizable.getProperty method. Should I get the node using the
autorizable's path and get the property? or should I handle a custom
property for that in this case? I just want to get the date the user was
created...

Thanks.

Jorge

Re: User created date property

Posted by Angela Schreiber <an...@adobe.com.INVALID>.
Hi Jorge

The action allows to modify the transient user before any changes are being saved. If you use a custom creation date a custom action comes closest to the auto-created jcr:created property.

Note however, that anyone with sufficient permission would be able to remove the custom property (the jcr:created however is defined as protected).

Kind regards
Angela

________________________________
From: jorgeeflorez <jo...@gmail.com>
Sent: Tuesday, February 16, 2021 12:38 PM
To: oak-dev@jackrabbit.apache.org <oa...@jackrabbit.apache.org>
Subject: Re: User created date property

Hi Angela,
thanks a lot for your reply. Yes, I thought using my own property to store
the creation date would be best, but never considered using an
AuthorizableAction.
I will take a look into it.

Best Regards.
Jorge


El mar., 16 de febrero de 2021 2:45 a. m., Angela Schreiber
<an...@adobe.com.invalid> escribió:

> Hi Jorge
>
> Your observation is correct: Authorizable.getProperty filters out
> properties in the jcr or rep namespace and only returns properties that
> could also be set using Authorizable.setProperty.
>
> If you add mix:created to a given user node (IMHO that is allowed) to have
> the jcr:created property set, you need to get the user node to read the
> jcr:created property. Alternatively, if you wish to avoid having that
> implementation detail (i.e. user is stored as a node) in your application,
> I suggest using a custom 'AuthorizableAction' that sets a custom 'created'
> property upon user creation.
>
> see
> http://jackrabbit.apache.org/oak/docs/security/user/authorizableaction.html
> for the corresponding documentation. NOTE: i recently fixed that part of
> the documentation. it missed to point to the required-service-ids in the
> security provider (see
> http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/security/user/authorizableaction.md?r1=1846652&r2=1885915).
> that is necessary in order to make sure the security provider is only
> registered if all dependencies are properly registered.
>
> Hope that helps
> Angela
>
> ________________________________
> From: jorgeeflorez <jo...@gmail.com>
> Sent: Thursday, February 11, 2021 8:37 PM
> To: oak-dev@jackrabbit.apache.org <oa...@jackrabbit.apache.org>
> Subject: User created date property
>
> Hi,
> I need to put and use additional properties on users and so far no problems
> with those properties. I could even add a mixin to the node that represents
> the user! (I am not sure if this is allowed).
>
> It seems that the "jcr:created" property cannot be seen using
> Authorizable.getProperty method. Should I get the node using the
> autorizable's path and get the property? or should I handle a custom
> property for that in this case? I just want to get the date the user was
> created...
>
> Thanks.
>
> Jorge
>

Re: User created date property

Posted by jorgeeflorez <jo...@gmail.com>.
Hi Angela,
thanks a lot for your reply. Yes, I thought using my own property to store
the creation date would be best, but never considered using an
AuthorizableAction.
I will take a look into it.

Best Regards.
Jorge


El mar., 16 de febrero de 2021 2:45 a. m., Angela Schreiber
<an...@adobe.com.invalid> escribió:

> Hi Jorge
>
> Your observation is correct: Authorizable.getProperty filters out
> properties in the jcr or rep namespace and only returns properties that
> could also be set using Authorizable.setProperty.
>
> If you add mix:created to a given user node (IMHO that is allowed) to have
> the jcr:created property set, you need to get the user node to read the
> jcr:created property. Alternatively, if you wish to avoid having that
> implementation detail (i.e. user is stored as a node) in your application,
> I suggest using a custom 'AuthorizableAction' that sets a custom 'created'
> property upon user creation.
>
> see
> http://jackrabbit.apache.org/oak/docs/security/user/authorizableaction.html
> for the corresponding documentation. NOTE: i recently fixed that part of
> the documentation. it missed to point to the required-service-ids in the
> security provider (see
> http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/security/user/authorizableaction.md?r1=1846652&r2=1885915).
> that is necessary in order to make sure the security provider is only
> registered if all dependencies are properly registered.
>
> Hope that helps
> Angela
>
> ________________________________
> From: jorgeeflorez <jo...@gmail.com>
> Sent: Thursday, February 11, 2021 8:37 PM
> To: oak-dev@jackrabbit.apache.org <oa...@jackrabbit.apache.org>
> Subject: User created date property
>
> Hi,
> I need to put and use additional properties on users and so far no problems
> with those properties. I could even add a mixin to the node that represents
> the user! (I am not sure if this is allowed).
>
> It seems that the "jcr:created" property cannot be seen using
> Authorizable.getProperty method. Should I get the node using the
> autorizable's path and get the property? or should I handle a custom
> property for that in this case? I just want to get the date the user was
> created...
>
> Thanks.
>
> Jorge
>

Re: User created date property

Posted by Angela Schreiber <an...@adobe.com.INVALID>.
Hi Jorge

Your observation is correct: Authorizable.getProperty filters out properties in the jcr or rep namespace and only returns properties that could also be set using Authorizable.setProperty.

If you add mix:created to a given user node (IMHO that is allowed) to have the jcr:created property set, you need to get the user node to read the jcr:created property. Alternatively, if you wish to avoid having that implementation detail (i.e. user is stored as a node) in your application, I suggest using a custom 'AuthorizableAction' that sets a custom 'created' property upon user creation.

see http://jackrabbit.apache.org/oak/docs/security/user/authorizableaction.html for the corresponding documentation. NOTE: i recently fixed that part of the documentation. it missed to point to the required-service-ids in the security provider (see http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/security/user/authorizableaction.md?r1=1846652&r2=1885915). that is necessary in order to make sure the security provider is only registered if all dependencies are properly registered.

Hope that helps
Angela

________________________________
From: jorgeeflorez <jo...@gmail.com>
Sent: Thursday, February 11, 2021 8:37 PM
To: oak-dev@jackrabbit.apache.org <oa...@jackrabbit.apache.org>
Subject: User created date property

Hi,
I need to put and use additional properties on users and so far no problems
with those properties. I could even add a mixin to the node that represents
the user! (I am not sure if this is allowed).

It seems that the "jcr:created" property cannot be seen using
Authorizable.getProperty method. Should I get the node using the
autorizable's path and get the property? or should I handle a custom
property for that in this case? I just want to get the date the user was
created...

Thanks.

Jorge