You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Georg Kallidis <gk...@cedis.fu-berlin.de> on 2016/08/11 13:16:23 UTC
Turbine 4 Final: How to save additional attributes into turbine_user, removed
in M2
Hi,
in the case, you need to save some more attributes as defined in
TurbineUser interface into turbine_user table - e.g. confirm_value,
last_login, created, password_changed (which were removed in Turbine M2),
I could find no other (easy)? way to get it to work but to
- extend
org.apache.fulcrum.security.model.turbine.entity.impl.TurbineUserImpl into
a new class (and interface), set/get required properties and
- declare it in
services.SecurityService.user.class=<extended class>
This class is set as userDelegate (of the hard coded reference
org.apache.turbine.om.security.DefaultUserImpl, see below), which defines
similar setters/getter (confirmed, createDate, lastLogin, but backed by
permstorage. It´s created in
org.apache.turbine.services.security.DefaultUserManager wrap method, e.g.
when a user instance is created.
By default DefaultUserManager.store(User) just retrieves the perm storage
and saves it, which is correct, if you have no colums for its own in
turbine_user table - which IS indeed the case in the new Fulcrum security
torque context, but is NOT the case for Turbine M1 and older/other.
To get it to work you also have to
- extend/override methods in DefaultUserImpl and set the required
attributes into the user delegate instead perm storage - most easily by
implementing the new interface.
To get the pieces work together you have to
- extend org.apache.turbine.services.security.DefaultUserManager
overriding the wrap method (setting DefaultUserImpl to appropriate class)
and declare the class in TR.properties
services.SecurityService.user.manager =
Is this the way to go in this case? Do other/better solutions exist? Any
other ideas?
I would indeed suggest to make DefaultUserImpl configurable, you haven´t
then to redefine SecurityService.user.manager and it would be more
intuitive IMO..
Best regards, Georg
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
For additional commands, e-mail: dev-help@turbine.apache.org
Antwort: Re: Turbine 4 Final: How to save additional attributes into
turbine_user, removed in M2
Posted by Georg Kallidis <gk...@cedis.fu-berlin.de>.
And and another correction.. ;-)
The new Fulcrum security package just saves the permStorage in objectData:
(Pseudo) Code example
-----------------------
Turbine
DefaultuserManager store(User user)
user.setObjectdata(ObjectUtils.serializeMap(user.getPermStorage()));
umDelegate.saveUser(((TurbineUserDelegate)user).getUserDelegate());
-----------------------
calls
-----------------------
Fulcrum
saveUser(User user) e.g. TorqueAbstractUserManager
TorqueAbstractSecurityEntity u =
(TorqueAbstractSecurityEntity)user;
u.setNew(false);
u.save();
-----------------------
u is the Fulcrum user class, which the user can set (the userDelegate).
If this user has additional properties they are of course NOT set, if
permStorage is saved only in objectData!
PermStorage is in new Fulcrum considered just "as is", i.e. it is saved
ONLY in objectData (please correct me, if I am not right).
You have no chance to map this to a real table column, except using your
own wrapper. To overwrite the column data, which would be then empty/null
with objectData nobody hopefully would consider an option..
In this case you have to implement your own wrapper, which will be
possible in new Turbine 4.0.
Best regards, Georg
Von: "Georg Kallidis" <gk...@cedis.fu-berlin.de>
An: "Turbine Developers List" <de...@turbine.apache.org>
Datum: 19.08.2016 12:22
Betreff: Antwort: Re: Turbine 4 Final: How to save additional
attributes into turbine_user, removed in M2
Hi,
sorry, for this multiple e-mails t othe same subject!
To clarify - if you have attributes in permStorage, the problem could just
solved using this.
It might be a bit difficult to get it, as no reference implementation is
left over to get an idea, how to do this (old example in
org.apache.turbine.om.security.peer.TurbineUserPeer buildCriteria in
Turbine 2.3.3 version). At least I could find nothing anymore neither in
Turbine nor Fulcrum Security. An example of how to use permStorage should
be used, would be helpful in any case.
Neverthelesse it might be useful to have a custom wrapper (FYI: it´s
already in turbine trunk), though it´s not required of course for
attributes already in DefaultUserImpl. You could use this indirection for
other attributes, methods, custom set/getter and you may be able to handle
issues with the database more easily, as some old example code was like
"permData.containsKey(TurbineUserPeer.columnNames[i])", which has the
requirement, that you have the same permStorage keys as in the database
(actually Torque 4 has global var fieldNames, which are lowercase..).
Did I miss something?
Best, Georg
Von: "Georg Kallidis" <gk...@cedis.fu-berlin.de>
An: "Turbine Developers List" <de...@turbine.apache.org>
Datum: 18.08.2016 13:07
Betreff: Re: Turbine 4 Final: How to save additional attributes
into turbine_user, removed in M2
just to mention it, this may be just another alternative to what is said
(a little bit hidden) about additional columns in
http://turbine.apache.org/turbine/turbine-4.0-M2/howto/extend-user-howto.html
.
I think, although the text is very insightful and mostly correct and
helpful, it should be reviewed before releasing the final version.
Best, Georg
Von: "Georg Kallidis" <gk...@cedis.fu-berlin.de>
An: "Turbine Developers List" <de...@turbine.apache.org>
Datum: 11.08.2016 15:16
Betreff: Turbine 4 Final: How to save additional attributes into
turbine_user, removed in M2
Hi,
in the case, you need to save some more attributes as defined in
TurbineUser interface into turbine_user table - e.g. confirm_value,
last_login, created, password_changed (which were removed in Turbine M2),
I could find no other (easy)? way to get it to work but to
- extend
org.apache.fulcrum.security.model.turbine.entity.impl.TurbineUserImpl into
a new class (and interface), set/get required properties and
- declare it in
services.SecurityService.user.class=<extended class>
This class is set as userDelegate (of the hard coded reference
org.apache.turbine.om.security.DefaultUserImpl, see below), which defines
similar setters/getter (confirmed, createDate, lastLogin, but backed by
permstorage. It´s created in
org.apache.turbine.services.security.DefaultUserManager wrap method, e.g.
when a user instance is created.
By default DefaultUserManager.store(User) just retrieves the perm storage
and saves it, which is correct, if you have no colums for its own in
turbine_user table - which IS indeed the case in the new Fulcrum security
torque context, but is NOT the case for Turbine M1 and older/other.
To get it to work you also have to
- extend/override methods in DefaultUserImpl and set the required
attributes into the user delegate instead perm storage - most easily by
implementing the new interface.
To get the pieces work together you have to
- extend org.apache.turbine.services.security.DefaultUserManager
overriding the wrap method (setting DefaultUserImpl to appropriate class)
and declare the class in TR.properties
services.SecurityService.user.manager =
Is this the way to go in this case? Do other/better solutions exist? Any
other ideas?
I would indeed suggest to make DefaultUserImpl configurable, you haven´t
then to redefine SecurityService.user.manager and it would be more
intuitive IMO..
Best regards, Georg
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
For additional commands, e-mail: dev-help@turbine.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
For additional commands, e-mail: dev-help@turbine.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
For additional commands, e-mail: dev-help@turbine.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
For additional commands, e-mail: dev-help@turbine.apache.org
Antwort: Re: Turbine 4 Final: How to save additional attributes into
turbine_user, removed in M2
Posted by Georg Kallidis <gk...@cedis.fu-berlin.de>.
Hi,
sorry, for this multiple e-mails t othe same subject!
To clarify - if you have attributes in permStorage, the problem could just
solved using this.
It might be a bit difficult to get it, as no reference implementation is
left over to get an idea, how to do this (old example in
org.apache.turbine.om.security.peer.TurbineUserPeer buildCriteria in
Turbine 2.3.3 version). At least I could find nothing anymore neither in
Turbine nor Fulcrum Security. An example of how to use permStorage should
be used, would be helpful in any case.
Neverthelesse it might be useful to have a custom wrapper (FYI: it´s
already in turbine trunk), though it´s not required of course for
attributes already in DefaultUserImpl. You could use this indirection for
other attributes, methods, custom set/getter and you may be able to handle
issues with the database more easily, as some old example code was like
"permData.containsKey(TurbineUserPeer.columnNames[i])", which has the
requirement, that you have the same permStorage keys as in the database
(actually Torque 4 has global var fieldNames, which are lowercase..).
Did I miss something?
Best, Georg
Von: "Georg Kallidis" <gk...@cedis.fu-berlin.de>
An: "Turbine Developers List" <de...@turbine.apache.org>
Datum: 18.08.2016 13:07
Betreff: Re: Turbine 4 Final: How to save additional attributes
into turbine_user, removed in M2
just to mention it, this may be just another alternative to what is said
(a little bit hidden) about additional columns in
http://turbine.apache.org/turbine/turbine-4.0-M2/howto/extend-user-howto.html
.
I think, although the text is very insightful and mostly correct and
helpful, it should be reviewed before releasing the final version.
Best, Georg
Von: "Georg Kallidis" <gk...@cedis.fu-berlin.de>
An: "Turbine Developers List" <de...@turbine.apache.org>
Datum: 11.08.2016 15:16
Betreff: Turbine 4 Final: How to save additional attributes into
turbine_user, removed in M2
Hi,
in the case, you need to save some more attributes as defined in
TurbineUser interface into turbine_user table - e.g. confirm_value,
last_login, created, password_changed (which were removed in Turbine M2),
I could find no other (easy)? way to get it to work but to
- extend
org.apache.fulcrum.security.model.turbine.entity.impl.TurbineUserImpl into
a new class (and interface), set/get required properties and
- declare it in
services.SecurityService.user.class=<extended class>
This class is set as userDelegate (of the hard coded reference
org.apache.turbine.om.security.DefaultUserImpl, see below), which defines
similar setters/getter (confirmed, createDate, lastLogin, but backed by
permstorage. It´s created in
org.apache.turbine.services.security.DefaultUserManager wrap method, e.g.
when a user instance is created.
By default DefaultUserManager.store(User) just retrieves the perm storage
and saves it, which is correct, if you have no colums for its own in
turbine_user table - which IS indeed the case in the new Fulcrum security
torque context, but is NOT the case for Turbine M1 and older/other.
To get it to work you also have to
- extend/override methods in DefaultUserImpl and set the required
attributes into the user delegate instead perm storage - most easily by
implementing the new interface.
To get the pieces work together you have to
- extend org.apache.turbine.services.security.DefaultUserManager
overriding the wrap method (setting DefaultUserImpl to appropriate class)
and declare the class in TR.properties
services.SecurityService.user.manager =
Is this the way to go in this case? Do other/better solutions exist? Any
other ideas?
I would indeed suggest to make DefaultUserImpl configurable, you haven´t
then to redefine SecurityService.user.manager and it would be more
intuitive IMO..
Best regards, Georg
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
For additional commands, e-mail: dev-help@turbine.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
For additional commands, e-mail: dev-help@turbine.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
For additional commands, e-mail: dev-help@turbine.apache.org
Re: Turbine 4 Final: How to save additional attributes into turbine_user, removed
in M2
Posted by Georg Kallidis <gk...@cedis.fu-berlin.de>.
just to mention it, this may be just another alternative to what is said
(a little bit hidden) about additional columns in
http://turbine.apache.org/turbine/turbine-4.0-M2/howto/extend-user-howto.html
.
I think, although the text is very insightful and mostly correct and
helpful, it should be reviewed before releasing the final version.
Best, Georg
Von: "Georg Kallidis" <gk...@cedis.fu-berlin.de>
An: "Turbine Developers List" <de...@turbine.apache.org>
Datum: 11.08.2016 15:16
Betreff: Turbine 4 Final: How to save additional attributes into
turbine_user, removed in M2
Hi,
in the case, you need to save some more attributes as defined in
TurbineUser interface into turbine_user table - e.g. confirm_value,
last_login, created, password_changed (which were removed in Turbine M2),
I could find no other (easy)? way to get it to work but to
- extend
org.apache.fulcrum.security.model.turbine.entity.impl.TurbineUserImpl into
a new class (and interface), set/get required properties and
- declare it in
services.SecurityService.user.class=<extended class>
This class is set as userDelegate (of the hard coded reference
org.apache.turbine.om.security.DefaultUserImpl, see below), which defines
similar setters/getter (confirmed, createDate, lastLogin, but backed by
permstorage. It´s created in
org.apache.turbine.services.security.DefaultUserManager wrap method, e.g.
when a user instance is created.
By default DefaultUserManager.store(User) just retrieves the perm storage
and saves it, which is correct, if you have no colums for its own in
turbine_user table - which IS indeed the case in the new Fulcrum security
torque context, but is NOT the case for Turbine M1 and older/other.
To get it to work you also have to
- extend/override methods in DefaultUserImpl and set the required
attributes into the user delegate instead perm storage - most easily by
implementing the new interface.
To get the pieces work together you have to
- extend org.apache.turbine.services.security.DefaultUserManager
overriding the wrap method (setting DefaultUserImpl to appropriate class)
and declare the class in TR.properties
services.SecurityService.user.manager =
Is this the way to go in this case? Do other/better solutions exist? Any
other ideas?
I would indeed suggest to make DefaultUserImpl configurable, you haven´t
then to redefine SecurityService.user.manager and it would be more
intuitive IMO..
Best regards, Georg
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
For additional commands, e-mail: dev-help@turbine.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@turbine.apache.org
For additional commands, e-mail: dev-help@turbine.apache.org