You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Zamek <za...@vili.pmmf.hu> on 2003/07/01 15:55:42 UTC
Extending user in T2.3
Hello All,
I need extending TurbineUser in my T2.3 app. In TR.properties I set
services.SecurityService.classname=org.apache.turbine.services.security.db.DBSecurityService
services.SecurityService.user.manager
=org.apache.turbine.services.security.db.DBUserManager
services.SecurityService.user.class=com.zamek.ecdl.om.EcdlUser
services.SecurityService.userPeer.class=com.zamek.ecdl.om.EcdlUserPeer
where EcdlUser is
extends com.zamek.ecdl.om.BaseEcdlUser implements Persistent, User
and BaseEcdlUser is
extends com.zamek.ecdl.om.TurbineUserAdapter
and TurbineUserAdapter is
extends org.apache.turbine.om.security.TurbineUser
like Extending user howto.
And when I try this:
EcdlUser usr = (EcdlUser) data.getUser();
I get an Exception:
java.lang.ClassCastException: org.apache.turbine.om.security.TurbineUser
at com.zamek.ecdl.modules.screens.Index.doBuildTemplate(Index.java:86)
It seems to be Turbine doesn't use my TR.properties settings. It remains
org.apache.turbine.om.security.TurbineUser.
How can I extending user?
I tried TorqueSecurityService as written in howto (config part at end of my
letter) and I have this error too:
java.lang.ClassCastException: org.apache.turbine.om.security.TurbineUser
I downloaded the latest version of turbine and torque too, and I successfully
compiled it with maven.
My Torque security settings
services.SecurityService.classname=org.apache.turbine.services.security.torque.TorqueSecurityService
services.SecurityService.torque.userPeer.class =
org.apache.turbine.services.security.torque.om.TurbineUserPeer
# The columns in the peer used to retrieve information. These are the names of
the constants
# in the configured peer
services.SecurityService.torque.userPeer.column.name = LOGIN_NAME
services.SecurityService.torque.userPeer.column.id = USER_ID
services.SecurityService.torque.userPeer.column.password = PASSWORD_VALUE
services.SecurityService.torque.userPeer.column.firstname = FIRST_NAME
services.SecurityService.torque.userPeer.column.lastname = LAST_NAME
services.SecurityService.torque.userPeer.column.email = EMAIL
services.SecurityService.torque.userPeer.column.confirm = CONFIRM_VALUE
services.SecurityService.torque.userPeer.column.createdate = CREATED
services.SecurityService.torque.userPeer.column.lastlogin = LAST_LOGIN
services.SecurityService.torque.userPeer.column.objectdata = OBJECTDATA
services.SecurityService.torque.user.class =
org.apache.turbine.services.security.torque.om.TurbineUser
# These bean properties are queried from the returned object to retrieve the
# information
services.SecurityService.torque.user.property.name = UserName
services.SecurityService.torque.user.property.id = UserId
services.SecurityService.torque.user.property.password = Password
services.SecurityService.torque.user.property.firstname = FirstName
services.SecurityService.torque.user.property.lastname = LastName
services.SecurityService.torque.user.property.email = Email
services.SecurityService.torque.user.property.confirm = Confirmed
services.SecurityService.torque.user.property.createdate = CreateDate
services.SecurityService.torque.user.property.lastlogin = LastLogin
services.SecurityService.torque.user.property.objectdata = Objectdata
# This is the Peer class used to access the Group Peer
(org.apache.turbine.services.security.torque.om.TurbineGroupPeer)
services.SecurityService.torque.groupPeer.class =
org.apache.turbine.services.security.torque.om.TurbineGroupPeer
# The columns in the peer used to retrieve information. These are the names of
the constants
# in the configured peer
services.SecurityService.torque.groupPeer.column.name = GROUP_NAME
services.SecurityService.torque.groupPeer.column.id = GROUP_ID
# These are the objects returned by the configured group peer
(org.apache.turbine.services.security.torque.om.TurbineGroup)
services.SecurityService.torque.group.class =
org.apache.turbine.services.security.torque.om.TurbineGroup
services.SecurityService.torque.group.property.name = Name
services.SecurityService.torque.group.property.id = GroupId
services.SecurityService.torque.rolePeer.class =
org.apache.turbine.services.security.torque.om.TurbineRolePeer
services.SecurityService.torque.rolePeer.column.name = ROLE_NAME
services.SecurityService.torque.rolePeer.column.id = ROLE_ID
services.SecurityService.torque.role.class =
org.apache.turbine.services.security.torque.om.TurbineRole
services.SecurityService.torque.role.property.name = Name
services.SecurityService.torque.role.property.id = RoleId
services.SecurityService.torque.permissionPeer.class =
org.apache.turbine.services.security.torque.om.TurbinePermissionPeer
services.SecurityService.torque.permissionPeer.column.name = PERMISSION_NAME
services.SecurityService.torque.permissionPeer.column.id = PERMISSION_ID
services.SecurityService.torque.permission.class =
org.apache.turbine.services.security.torque.om.TurbinePermission
services.SecurityService.torque.permission.property.name = Name
services.SecurityService.torque.permission.property.id = PermissionId
TIA
--
udv,
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"David Wynter" <da...@roamware.co.uk> writes:
This is, afaik a shortcoming of Torque. You can't reference a table outside
your current schema.xml file.
I ended up having about 60 table definitions in a single schema.xml file
because of this. Speaking of horrors...
Regards
Henning
>Another quick question on the example below.
>Assuming the schema below goes into your
>"package="de.intermeta.myapp.security.om"" package and you have your
>application om classes in say "package="de.intermeta.myapp.om"" then how do
>you reference your MYAPP_USER as a foreign key in ylour application schema
>xml file
>i.e. in a table specification in your application schema declaration you
>have
> <foreign-key foreignTable="MYAPP_USER">
> <reference local="creator_id" foreign="USER_ID"/>
> </foreign-key>
>Will this work?
>Thanks
>David
>-----Original Message-----
>From: Henning P. Schmiedehausen [mailto:hps@intermeta.de]
>Sent: 02 July 2003 14:16
>To: turbine-user@jakarta.apache.org
>Subject: Re: Extending user in T2.3
>Zamek <za...@vili.pmmf.hu> writes:
>>I would like to get a working TR.props file or a part of TR.prop
>>for compensation, I will correct, and comment the documentation.
>Ok, the following is cut life out of the application running in the
>window behind this one...
>--- cut ---
>services.SecurityService.classname=org.apache.turbine.services.security.torq
>ue.TorqueSecurityService
>[...]
># -------------------------------------------------------------------
>#
># S E C U R I T Y S E R V I C E
>#
># -------------------------------------------------------------------
># Default: org.apache.turbine.services.security.db.DBUserManager
>services.SecurityService.user.manager =
>org.apache.turbine.services.security.torque.TorqueUserManager
># This is the class that implements the ACL interface.
>services.SecurityService.acl.class =
>org.apache.turbine.util.security.TurbineAccessControlList
>#
># Configure Object Classes in the Security Service
>#
># Custom User
>services.SecurityService.user.class = de.intermeta.myapp.security.MyAppUser
>services.SecurityService.group.class =
>org.apache.turbine.services.security.torque.TorqueGroup
>services.SecurityService.permission.class =
>org.apache.turbine.services.security.torque.TorquePermission
>services.SecurityService.role.class =
>org.apache.turbine.services.security.torque.TorqueRole
>#
># Configure Peers for the Torque Security Service
>#
>services.SecurityService.torque.userPeer.class =
>de.intermeta.myapp.security.om.MyappUserPeer
>services.SecurityService.torque.groupPeer.class =
>de.intermeta.myapp.security.om.MyappGroupPeer
>services.SecurityService.torque.permissionPeer.class =
>de.intermeta.myapp.security.om.MyappPermissionPeer
>services.SecurityService.torque.rolePeer.class =
>de.intermeta.myapp.security.om.MyappRolePeer
>[...]
>--- cut ---
>--- cut --- myapp-schema.xml ---
><?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
><!DOCTYPE database SYSTEM
>"http://jakarta.apache.org/turbine/dtd/database_3_1.dtd">
><database name="myapp"
> defaultIdMethod="idbroker"
> defaultJavaType="primitive"
> defaultJavaNamingMethod="underscore"
> package="de.intermeta.myapp.security.om">
> <table name="MYAPP_USER" idMethod="idbroker">
> <column name="USER_ID" required="true" primaryKey="true"
>type="INTEGER"/>
> <column name="LOGIN_NAME" required="true" size="64" type="VARCHAR"
>javaName="UserName"/>
> <column name="PASSWORD_VALUE" required="true" size="16" type="VARCHAR"
>javaName="Password"/>
> <column name="FIRST_NAME" required="true" size="64" type="VARCHAR"/>
> <column name="LAST_NAME" required="true" size="64" type="VARCHAR"/>
> <column name="EMAIL" size="64" type="VARCHAR"/>
> <column name="CONFIRM_VALUE" size="16" type="VARCHAR"
>javaName="Confirmed"/>
> <column name="MODIFIED" type="TIMESTAMP" size="0"/>
> <column name="CREATED" type="TIMESTAMP" size="0" javaName="CreateDate"/>
> <column name="LAST_LOGIN" type="TIMESTAMP" size="0"/>
> <column name="OBJECTDATA" type="VARBINARY"/>
><!-- Myapp Erweiterungen -->
> <!-- Aktuell ausgewaehlte Sprachversion -->
> <column name="MYAPP_LANGUAGE_ID" type="INTEGER" javaName="LanguageId"/>
> <!-- Aktuell ausgewaehlte Gruppe -->
> <column name="MYAPP_GRUPPEN_ID" type="INTEGER" javaName="GruppenId"/>
> <unique>
> <unique-column name="LOGIN_NAME"/>
> </unique>
> </table>
> <table name="MYAPP_PERMISSION" idMethod="idbroker">
> <column name="PERMISSION_ID" required="true" primaryKey="true"
>type="INTEGER"/>
> <column name="PERMISSION_NAME" required="true" size="64" type="VARCHAR"
>javaName="Name"/>
> <unique>
> <unique-column name="PERMISSION_NAME"/>
> </unique>
> </table>
> <table name="MYAPP_ROLE" idMethod="idbroker">
> <column name="ROLE_ID" required="true" primaryKey="true"
>type="INTEGER"/>
> <column name="ROLE_NAME" required="true" size="64" type="VARCHAR"
>javaName="Name"/>
> <unique>
> <unique-column name="ROLE_NAME"/>
> </unique>
> </table>
> <table name="MYAPP_GROUP" idMethod="idbroker">
> <column name="GROUP_ID" required="true" primaryKey="true"
>type="INTEGER"/>
> <column name="GROUP_NAME" required="true" type="VARCHAR" size="64"
>javaName="Name"/>
> <unique>
> <unique-column name="GROUP_NAME"/>
> </unique>
> </table>
> <table name="TURBINE_ROLE_PERMISSION">
> <column name="ROLE_ID" required="true" primaryKey="true"
>type="INTEGER"/>
> <column name="PERMISSION_ID" required="true" primaryKey="true"
>type="INTEGER"/>
> <foreign-key foreignTable="MYAPP_ROLE">
> <reference local="ROLE_ID" foreign="ROLE_ID"/>
> </foreign-key>
> <foreign-key foreignTable="MYAPP_PERMISSION">
> <reference local="PERMISSION_ID" foreign="PERMISSION_ID"/>
> </foreign-key>
> </table>
> <table name="TURBINE_USER_GROUP_ROLE">
> <column name="USER_ID" required="true" primaryKey="true"
>type="INTEGER"/>
> <column name="GROUP_ID" required="true" primaryKey="true"
>type="INTEGER"/>
> <column name="ROLE_ID" required="true" primaryKey="true"
>type="INTEGER"/>
> <foreign-key foreignTable="MYAPP_USER">
> <reference local="USER_ID" foreign="USER_ID"/>
> </foreign-key>
> <foreign-key foreignTable="MYAPP_GROUP">
> <reference local="GROUP_ID" foreign="GROUP_ID"/>
> </foreign-key>
> <foreign-key foreignTable="MYAPP_ROLE">
> <reference local="ROLE_ID" foreign="ROLE_ID"/>
> </foreign-key>
> </table>
></database>
>--- cut --- myapp-schema.xml ---
>--- cut --- MyAppUser.java ---
>package de.intermeta.myapp.security;
>import org.apache.turbine.services.security.torque.TorqueUser;
>import de.intermeta.myapp.security.om.MyappUser;
>public class MyAppUser
> extends TorqueUser
>{
> /**
> * Constructor.
> */
> public MyAppUser()
> {
> super();
> }
> /**
> * This Constructor is used when the UserPeerManager
> * has retrieved a list of Database Objects from the peer and
> * must 'wrap' them into TorqueRole Objects. You should not use it
>directly!
> *
> * @param obj An Object from the peer
> */
> public MyAppUser(Persistent obj)
> {
> super(obj);
> }
> public int getLanguageId()
> {
> return ((MyappUser) getPersistentObj()).getLanguageId();
> }
> public void setLanguageId(int languageId)
> {
> ((MyappUser) getPersistentObj()).setLanguageId(languageId);
> }
> public int getGruppenId()
> {
> return ((MyappUser) getPersistentObj()).getGruppenId();
> }
> public void setGruppenId(int gruppenId)
> {
> ((MyappUser) getPersistentObj()).setGruppenId(gruppenId);
> }
>}
>--- cut --- MyAppUser.java ---
>- Run the schema, you should get de.intermeta.myapp.security.om.<lots of
>classes>
>- add de.intermeta.maxpatch.myapp.security.MyAppUser.java
>- configure Turbine as described above
>- create the tables with maven torque:sql, put them into a database (I use
>PostgreSQL).
>Insert some data into the tables:
>--- cut ---
>INSERT INTO MYAPP_USER
>(USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
> VALUES (1,'turbine','turbine','Mr.','Turbine');
>INSERT INTO MYAPP_PERMISSION (PERMISSION_ID,PERMISSION_NAME)
> VALUES (1,'Myapp');
>INSERT INTO MYAPP_ROLE (ROLE_ID,ROLE_NAME)
> VALUES (1,'MyappAdmin');
>INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
> VALUES (1,'global');
>INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
> VALUES (2,'Myapp');
>INSERT INTO TURBINE_ROLE_PERMISSION (ROLE_ID,PERMISSION_ID)
> VALUES (1,1);
>INSERT INTO TURBINE_USER_GROUP_ROLE (USER_ID,GROUP_ID,ROLE_ID)
> VALUES (1,2,1);
>--- cut ---
>Now you should be able to log on with user "turbine" , pw "turbine".
> Regards
> Henning
>--
>Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
>hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
>Java, perl, Solaris, Linux, xSP Consulting, Web Services
>freelance consultant -- Jakarta Turbine Development -- hero for hire
>--- Quote of the week: "It is pointless to tell people anything when
>you know that they won't process the message." --- Jonathan Revusky
>---------------------------------------------------------------------
>To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>---------------------------------------------------------------------
>To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: turbine-user-help@jakarta.apache.org
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"David Wynter" <da...@roamware.co.uk> writes:
>Hi Henning,
>Just a point of clarification on the changes to extend TurbineUser in
>T2.3-dev below.
>Below you have your extension classes in the package
>"de.intermeta.myapp.security.om" and in a later email to the list you said I
>could not reference via foreign key the extended user table unless it was
>all in one *-schema.xml file. Does this mean you have all your application
>classes in the *.security.om package (!?) as well as the security specific
>ones?.
Hi,
well, this might be a Torque limitation. Actually I've never really
thought about this. The problem is, that Torque won't allow you to use
a <foreign-key> tag to reference a table that is not in the same
schema.xml file.
Maybe Martin can say something to this. I'm not exactly a Torque guru.
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by Zamek <za...@vili.pmmf.hu>.
Hello,
On Wednesday 02 July 2003 15.16, Henning P. Schmiedehausen wrote:
> Zamek <za...@vili.pmmf.hu> writes:
> >I would like to get a working TR.props file or a part of TR.prop
> >
> >for compensation, I will correct, and comment the documentation.
>
> Ok, the following is cut life out of the application running in the
> window behind this one...
Thanks, at end of week I will try it ...
--
bye,
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"Devlin Daley" <dr...@email.byu.edu> writes:
No. Torque Security Service is a strict 2.3 thing. Sorry.
Regards
Henning
>In my current application, I also need to extend TurbineUser and am
>looking at all of my options. This thread shows one of the options, but
>is always referenced as Turbine 2.3. Will the Torque Security Service
>solution described work in TDK2.2?
>Regards,
>Devlin Daley
>-----Original Message-----
>From: Zamek [mailto:zamek@vili.pmmf.hu]
>Sent: Monday, July 14, 2003 6:32 AM
>To: Turbine Users List
>Subject: Re: Extending user in T2.3
>On Monday 14 July 2003 12.30, Henning P. Schmiedehausen wrote:
>> Zamek <za...@vili.pmmf.hu> writes:
>> >Hello All,
>> >
>> >Sorry I forgot to address my thanks in my last letter.
>> >
>> >So many thanks to Henning P. Schmiedehausen for Torque Security
>Service
>> >implementation help.
>> >I will test it, and publish its user friendly documentation.
>>
>> Did you get it to work? Great!
>Oh yes, it works very well :-)
>I could setup it based your intentions, and simply works :-)
>Many thanks to you, I will comment and publish it.
>--
>thanks,
>Zoltan Zidarics programmer
>PTE University Pecs, Hungary
>icq: 43288694
>---------------------------------------------------------------------
>To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>---------------------------------------------------------------------
>To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: turbine-user-help@jakarta.apache.org
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
RE: Extending user in T2.3
Posted by Devlin Daley <dr...@email.byu.edu>.
In my current application, I also need to extend TurbineUser and am
looking at all of my options. This thread shows one of the options, but
is always referenced as Turbine 2.3. Will the Torque Security Service
solution described work in TDK2.2?
Regards,
Devlin Daley
-----Original Message-----
From: Zamek [mailto:zamek@vili.pmmf.hu]
Sent: Monday, July 14, 2003 6:32 AM
To: Turbine Users List
Subject: Re: Extending user in T2.3
On Monday 14 July 2003 12.30, Henning P. Schmiedehausen wrote:
> Zamek <za...@vili.pmmf.hu> writes:
> >Hello All,
> >
> >Sorry I forgot to address my thanks in my last letter.
> >
> >So many thanks to Henning P. Schmiedehausen for Torque Security
Service
> >implementation help.
> >I will test it, and publish its user friendly documentation.
>
> Did you get it to work? Great!
Oh yes, it works very well :-)
I could setup it based your intentions, and simply works :-)
Many thanks to you, I will comment and publish it.
--
thanks,
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by Zamek <za...@vili.pmmf.hu>.
On Monday 14 July 2003 12.30, Henning P. Schmiedehausen wrote:
> Zamek <za...@vili.pmmf.hu> writes:
> >Hello All,
> >
> >Sorry I forgot to address my thanks in my last letter.
> >
> >So many thanks to Henning P. Schmiedehausen for Torque Security Service
> >implementation help.
> >I will test it, and publish its user friendly documentation.
>
> Did you get it to work? Great!
Oh yes, it works very well :-)
I could setup it based your intentions, and simply works :-)
Many thanks to you, I will comment and publish it.
--
thanks,
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Zamek <za...@vili.pmmf.hu> writes:
>Hello All,
>Sorry I forgot to address my thanks in my last letter.
>So many thanks to Henning P. Schmiedehausen for Torque Security Service
>implementation help.
>I will test it, and publish its user friendly documentation.
Did you get it to work? Great!
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by Zamek <za...@vili.pmmf.hu>.
Hello All,
Sorry I forgot to address my thanks in my last letter.
So many thanks to Henning P. Schmiedehausen for Torque Security Service
implementation help.
I will test it, and publish its user friendly documentation.
--
bye,
----------------------------------------------------
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by Zamek <za...@vili.pmmf.hu>.
Hello All,
> >I would like to get a working TR.props file or a part of TR.prop
> >
> >for compensation, I will correct, and comment the documentation.
>
> Ok, the following is cut life out of the application running in the
> window behind this one...
Many thanks to you, it works well :-)
I will create a user friendly documentation for this and I'll populate it...
--
bye,
----------------------------------------------------
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
RE: Extending user in T2.3
Posted by Henning Schmiedehausen <hp...@intermeta.de>.
Hi,
On Thu, 2003-07-03 at 15:01, David Wynter wrote:
> Hi Henning,
>
> Just trying out your extended user approach below (while killing time until
> I can get some advice on this unresolved 'category' generatino problem).
>
> I have a question on the example. You replace the TURBINE_NNN for Group,
> Permission and Role and yet they have the same columns and you have left the
> cross tables as the TURBINE supplied ones. Is this because you have to or is
The cross tables do have different foreign key references than the
"original" turbine supplied.
I left the original column names out of lazyness. The Torque Security
Service allows you to configure every column as you wish, but if you
don't change the column names, the defaults fit and you don't have to
put lots of column name definitions into your TR.properties.
In the torque security service docs in the turbine-2.3 site on jakarta
is a list of properties for each security object that you can use to
change the colum names. This is intended for people who have an existing
table scheme and must adapt Turbine to their needs.
> it just for the exercise? In other words, can I just replace TURBINE_USER
> with my CUSTOM_USER and continue to use the torque generate TURBINE_NNN
> tables for the others?
yes, sure. You can e.g. use CUSTOM_USER, TURBINE_GROUP, TURBINE_ROLE and
TURBINE_PERMISSION. In our application, we just wanted to keep one
prefix for all of the Security tables.
However, you must regenerate the ROLE_PERMISSION and USER_GROUP_ROLE
SQL-table definitions, if you use foreign keys. If you use e.g. MySQL,
you might even get away with the existing tables. If you use PostgreSQL,
you don't. _
And_ (caveat) the tables _must_ be named TURBINE_ROLE_PERMISSION and
TURBINE_USER_GROUP_ROLE, because the peers names
(TurbineRolePermissionPeer and TurbineUserGroupRolePeer) are hardcoded
in the Turbine source. :-)
Regards
Henning
>
> regards,
>
> David
>
> -----Original Message-----
> From: Henning P. Schmiedehausen [mailto:hps@intermeta.de]
> Sent: 02 July 2003 14:16
> To: turbine-user@jakarta.apache.org
> Subject: Re: Extending user in T2.3
>
>
> Zamek <za...@vili.pmmf.hu> writes:
>
> >I would like to get a working TR.props file or a part of TR.prop
>
> >for compensation, I will correct, and comment the documentation.
>
> Ok, the following is cut life out of the application running in the
> window behind this one...
>
> --- cut ---
> services.SecurityService.classname=org.apache.turbine.services.security.torq
> ue.TorqueSecurityService
> [...]
> # -------------------------------------------------------------------
> #
> # S E C U R I T Y S E R V I C E
> #
> # -------------------------------------------------------------------
>
> # Default: org.apache.turbine.services.security.db.DBUserManager
> services.SecurityService.user.manager =
> org.apache.turbine.services.security.torque.TorqueUserManager
>
> # This is the class that implements the ACL interface.
> services.SecurityService.acl.class =
> org.apache.turbine.util.security.TurbineAccessControlList
>
> #
> # Configure Object Classes in the Security Service
> #
>
> # Custom User
> services.SecurityService.user.class = de.intermeta.myapp.security.MyAppUser
>
> services.SecurityService.group.class =
> org.apache.turbine.services.security.torque.TorqueGroup
> services.SecurityService.permission.class =
> org.apache.turbine.services.security.torque.TorquePermission
> services.SecurityService.role.class =
> org.apache.turbine.services.security.torque.TorqueRole
>
> #
> # Configure Peers for the Torque Security Service
> #
> services.SecurityService.torque.userPeer.class =
> de.intermeta.myapp.security.om.MyappUserPeer
> services.SecurityService.torque.groupPeer.class =
> de.intermeta.myapp.security.om.MyappGroupPeer
> services.SecurityService.torque.permissionPeer.class =
> de.intermeta.myapp.security.om.MyappPermissionPeer
> services.SecurityService.torque.rolePeer.class =
> de.intermeta.myapp.security.om.MyappRolePeer
>
> [...]
>
> --- cut ---
>
> --- cut --- myapp-schema.xml ---
> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
> <!DOCTYPE database SYSTEM
> "http://jakarta.apache.org/turbine/dtd/database_3_1.dtd">
>
> <database name="myapp"
> defaultIdMethod="idbroker"
> defaultJavaType="primitive"
> defaultJavaNamingMethod="underscore"
> package="de.intermeta.myapp.security.om">
>
> <table name="MYAPP_USER" idMethod="idbroker">
> <column name="USER_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="LOGIN_NAME" required="true" size="64" type="VARCHAR"
> javaName="UserName"/>
> <column name="PASSWORD_VALUE" required="true" size="16" type="VARCHAR"
> javaName="Password"/>
> <column name="FIRST_NAME" required="true" size="64" type="VARCHAR"/>
> <column name="LAST_NAME" required="true" size="64" type="VARCHAR"/>
> <column name="EMAIL" size="64" type="VARCHAR"/>
> <column name="CONFIRM_VALUE" size="16" type="VARCHAR"
> javaName="Confirmed"/>
> <column name="MODIFIED" type="TIMESTAMP" size="0"/>
> <column name="CREATED" type="TIMESTAMP" size="0" javaName="CreateDate"/>
> <column name="LAST_LOGIN" type="TIMESTAMP" size="0"/>
> <column name="OBJECTDATA" type="VARBINARY"/>
>
> <!-- Myapp Erweiterungen -->
>
> <!-- Aktuell ausgewaehlte Sprachversion -->
> <column name="MYAPP_LANGUAGE_ID" type="INTEGER" javaName="LanguageId"/>
> <!-- Aktuell ausgewaehlte Gruppe -->
> <column name="MYAPP_GRUPPEN_ID" type="INTEGER" javaName="GruppenId"/>
>
> <unique>
> <unique-column name="LOGIN_NAME"/>
> </unique>
>
> </table>
>
> <table name="MYAPP_PERMISSION" idMethod="idbroker">
> <column name="PERMISSION_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="PERMISSION_NAME" required="true" size="64" type="VARCHAR"
> javaName="Name"/>
>
> <unique>
> <unique-column name="PERMISSION_NAME"/>
> </unique>
>
> </table>
>
> <table name="MYAPP_ROLE" idMethod="idbroker">
> <column name="ROLE_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="ROLE_NAME" required="true" size="64" type="VARCHAR"
> javaName="Name"/>
>
> <unique>
> <unique-column name="ROLE_NAME"/>
> </unique>
>
> </table>
>
> <table name="MYAPP_GROUP" idMethod="idbroker">
> <column name="GROUP_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="GROUP_NAME" required="true" type="VARCHAR" size="64"
> javaName="Name"/>
>
> <unique>
> <unique-column name="GROUP_NAME"/>
> </unique>
>
> </table>
>
> <table name="TURBINE_ROLE_PERMISSION">
> <column name="ROLE_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="PERMISSION_ID" required="true" primaryKey="true"
> type="INTEGER"/>
>
> <foreign-key foreignTable="MYAPP_ROLE">
> <reference local="ROLE_ID" foreign="ROLE_ID"/>
> </foreign-key>
>
> <foreign-key foreignTable="MYAPP_PERMISSION">
> <reference local="PERMISSION_ID" foreign="PERMISSION_ID"/>
> </foreign-key>
> </table>
>
> <table name="TURBINE_USER_GROUP_ROLE">
> <column name="USER_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="GROUP_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="ROLE_ID" required="true" primaryKey="true"
> type="INTEGER"/>
>
> <foreign-key foreignTable="MYAPP_USER">
> <reference local="USER_ID" foreign="USER_ID"/>
> </foreign-key>
>
> <foreign-key foreignTable="MYAPP_GROUP">
> <reference local="GROUP_ID" foreign="GROUP_ID"/>
> </foreign-key>
>
> <foreign-key foreignTable="MYAPP_ROLE">
> <reference local="ROLE_ID" foreign="ROLE_ID"/>
> </foreign-key>
> </table>
>
> </database>
> --- cut --- myapp-schema.xml ---
>
>
> --- cut --- MyAppUser.java ---
> package de.intermeta.myapp.security;
>
> import org.apache.turbine.services.security.torque.TorqueUser;
>
> import de.intermeta.myapp.security.om.MyappUser;
>
> public class MyAppUser
> extends TorqueUser
> {
> /**
> * Constructor.
> */
> public MyAppUser()
> {
> super();
> }
>
> /**
> * This Constructor is used when the UserPeerManager
> * has retrieved a list of Database Objects from the peer and
> * must 'wrap' them into TorqueRole Objects. You should not use it
> directly!
> *
> * @param obj An Object from the peer
> */
> public MyAppUser(Persistent obj)
> {
> super(obj);
> }
>
>
> public int getLanguageId()
> {
> return ((MyappUser) getPersistentObj()).getLanguageId();
> }
>
> public void setLanguageId(int languageId)
> {
> ((MyappUser) getPersistentObj()).setLanguageId(languageId);
> }
>
> public int getGruppenId()
> {
> return ((MyappUser) getPersistentObj()).getGruppenId();
> }
>
> public void setGruppenId(int gruppenId)
> {
> ((MyappUser) getPersistentObj()).setGruppenId(gruppenId);
> }
> }
> --- cut --- MyAppUser.java ---
>
> - Run the schema, you should get de.intermeta.myapp.security.om.<lots of
> classes>
> - add de.intermeta.maxpatch.myapp.security.MyAppUser.java
> - configure Turbine as described above
> - create the tables with maven torque:sql, put them into a database (I use
> PostgreSQL).
>
> Insert some data into the tables:
>
> --- cut ---
> INSERT INTO MYAPP_USER
> (USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
> VALUES (1,'turbine','turbine','Mr.','Turbine');
>
> INSERT INTO MYAPP_PERMISSION (PERMISSION_ID,PERMISSION_NAME)
> VALUES (1,'Myapp');
>
> INSERT INTO MYAPP_ROLE (ROLE_ID,ROLE_NAME)
> VALUES (1,'MyappAdmin');
>
>
> INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
> VALUES (1,'global');
>
>
> INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
> VALUES (2,'Myapp');
>
>
> INSERT INTO TURBINE_ROLE_PERMISSION (ROLE_ID,PERMISSION_ID)
> VALUES (1,1);
>
>
> INSERT INTO TURBINE_USER_GROUP_ROLE (USER_ID,GROUP_ID,ROLE_ID)
> VALUES (1,2,1);
>
> --- cut ---
>
> Now you should be able to log on with user "turbine" , pw "turbine".
>
> Regards
> Henning
>
>
>
>
> --
> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
> hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
>
> Java, perl, Solaris, Linux, xSP Consulting, Web Services
> freelance consultant -- Jakarta Turbine Development -- hero for hire
>
> --- Quote of the week: "It is pointless to tell people anything when
> you know that they won't process the message." --- Jonathan Revusky
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Keith Seim <ke...@kjsdesigns.com> writes:
This is fine and correct for the DBSecurityService and Turbine 2.2
Turbine 2.3 however (and the TorqueSecurityService) give you much more
flexibility.
Regards
Henning
>--Apple-Mail-4--525461840
>Content-Transfer-Encoding: quoted-printable
>Content-Type: text/plain;
> charset=WINDOWS-1252;
> format=flowed
>I'm not sure what you mean by "yet they have the same columns and you=20
>have left the
>cross tables as the TURBINE supplied ones" I assume you mean that the=20
>tables and columns are still named the same. I'm a newbie, but I have=20=
>fiddled and researched and asked about users myself. The point of=20
>keeping TURBINE_USER as-is (without modifying it's name or columns) is=20=
>so that you can still use the Security feature:
>=
>http://jakarta.apache.org/turbine/turbine-2.2.1/howto/security-howto.html
>As seen in the Turbine-User how-to:
>http://jakarta.apache.org/turbine/turbine-2.2.1/howto/extend-user-
>howto.html (40% down the page, code block "public class=20
>TurbineUserAdapter extends TurbineUser")
>The point of extending the user (instead of simply creating your own) is=20=
>so that your "user" class is compatible with TurbineUser. If you=20
>alter/delete the table or columns, you'll have to mess with=20
>TurbineUser. If you really need a CUSTOM_USER table, I believe your=20
>options are:
>a) add the columns you need to Turbine_User; following the extend-user=20=
>how-to,
>b) simply FK TURBINE_USER from your own CUSTOM_USER table... then you=20
>can have your cake and eat it too, or
>c) throw away the Turbine-Security features altogether.
>Hope that helps
>Keith
>On Thursday, July 3, 2003, at 09:01 AM, David Wynter wrote:
>> Hi Henning,
>>
>> Just trying out your extended user approach below (while killing time=20=
>> until
>> I can get some advice on this unresolved 'category' generatino =
>problem).
>>
>> I have a question on the example. You replace the TURBINE_NNN for =
>Group,
>> Permission and Role and yet they have the same columns and you have=20
>> left the
>> cross tables as the TURBINE supplied ones. Is this because you have to=20=
>> or is
>> it just for the exercise? In other words, can I just replace=20
>> TURBINE_USER
>> with my CUSTOM_USER and continue to use the torque generate =
>TURBINE_NNN
>> tables for the others?
>>
>> regards,
>>
>> David
>>
>> -----Original Message-----
>> From: Henning P. Schmiedehausen [mailto:hps@intermeta.de]
>> Sent: 02 July 2003 14:16
>> To: turbine-user@jakarta.apache.org
>> Subject: Re: Extending user in T2.3
>>
>>
>> Zamek <za...@vili.pmmf.hu> writes:
>>
>>> I would like to get a working TR.props file or a part of TR.prop
>>
>>> for compensation, I will correct, and comment the documentation.
>>
>> Ok, the following is cut life out of the application running in the
>> window behind this one...
>>
>> --- cut ---
>> =
>services.SecurityService.classname=3Dorg.apache.turbine.services.security.=
>torq
>> ue.TorqueSecurityService
>> [...]
>> # -------------------------------------------------------------------
>> #
>> # S E C U R I T Y S E R V I C E
>> #
>> # -------------------------------------------------------------------
>>
>> # Default: org.apache.turbine.services.security.db.DBUserManager
>> services.SecurityService.user.manager =3D
>> org.apache.turbine.services.security.torque.TorqueUserManager
>>
>> # This is the class that implements the ACL interface.
>> services.SecurityService.acl.class =3D
>> org.apache.turbine.util.security.TurbineAccessControlList
>>
>> #
>> # Configure Object Classes in the Security Service
>> #
>>
>> # Custom User
>> services.SecurityService.user.class =3D=20
>> de.intermeta.myapp.security.MyAppUser
>>
>> services.SecurityService.group.class =3D
>> org.apache.turbine.services.security.torque.TorqueGroup
>> services.SecurityService.permission.class =3D
>> org.apache.turbine.services.security.torque.TorquePermission
>> services.SecurityService.role.class =3D
>> org.apache.turbine.services.security.torque.TorqueRole
>>
>> #
>> # Configure Peers for the Torque Security Service
>> #
>> services.SecurityService.torque.userPeer.class =3D
>> de.intermeta.myapp.security.om.MyappUserPeer
>> services.SecurityService.torque.groupPeer.class =3D
>> de.intermeta.myapp.security.om.MyappGroupPeer
>> services.SecurityService.torque.permissionPeer.class =3D
>> de.intermeta.myapp.security.om.MyappPermissionPeer
>> services.SecurityService.torque.rolePeer.class =3D
>> de.intermeta.myapp.security.om.MyappRolePeer
>>
>> [...]
>>
>> --- cut ---
>>
>> --- cut --- myapp-schema.xml ---
>> <?xml version=3D"1.0" encoding=3D"ISO-8859-1" standalone=3D"no"?>
>> <!DOCTYPE database SYSTEM
>> "http://jakarta.apache.org/turbine/dtd/database_3_1.dtd">
>>
>> <database name=3D"myapp"
>> defaultIdMethod=3D"idbroker"
>> defaultJavaType=3D"primitive"
>> defaultJavaNamingMethod=3D"underscore"
>> package=3D"de.intermeta.myapp.security.om">
>>
>> <table name=3D"MYAPP_USER" idMethod=3D"idbroker">
>> <column name=3D"USER_ID" required=3D"true" primaryKey=3D"true"
>> type=3D"INTEGER"/>
>> <column name=3D"LOGIN_NAME" required=3D"true" size=3D"64" =
>type=3D"VARCHAR"
>> javaName=3D"UserName"/>
>> <column name=3D"PASSWORD_VALUE" required=3D"true" size=3D"16"=20
>> type=3D"VARCHAR"
>> javaName=3D"Password"/>
>> <column name=3D"FIRST_NAME" required=3D"true" size=3D"64" =
>type=3D"VARCHAR"/>
>> <column name=3D"LAST_NAME" required=3D"true" size=3D"64" =
>type=3D"VARCHAR"/>
>> <column name=3D"EMAIL" size=3D"64" type=3D"VARCHAR"/>
>> <column name=3D"CONFIRM_VALUE" size=3D"16" type=3D"VARCHAR"
>> javaName=3D"Confirmed"/>
>> <column name=3D"MODIFIED" type=3D"TIMESTAMP" size=3D"0"/>
>> <column name=3D"CREATED" type=3D"TIMESTAMP" size=3D"0"=20
>> javaName=3D"CreateDate"/>
>> <column name=3D"LAST_LOGIN" type=3D"TIMESTAMP" size=3D"0"/>
>> <column name=3D"OBJECTDATA" type=3D"VARBINARY"/>
>>
>> <!-- Myapp Erweiterungen -->
>>
>> <!-- Aktuell ausgewaehlte Sprachversion -->
>> <column name=3D"MYAPP_LANGUAGE_ID" type=3D"INTEGER"=20
>> javaName=3D"LanguageId"/>
>> <!-- Aktuell ausgewaehlte Gruppe -->
>> <column name=3D"MYAPP_GRUPPEN_ID" type=3D"INTEGER"=20
>> javaName=3D"GruppenId"/>
>>
>> <unique>
>> <unique-column name=3D"LOGIN_NAME"/>
>> </unique>
>>
>> </table>
>>
>> <table name=3D"MYAPP_PERMISSION" idMethod=3D"idbroker">
>> <column name=3D"PERMISSION_ID" required=3D"true" primaryKey=3D"true"=
>> type=3D"INTEGER"/>
>> <column name=3D"PERMISSION_NAME" required=3D"true" size=3D"64"=20
>> type=3D"VARCHAR"
>> javaName=3D"Name"/>
>>
>> <unique>
>> <unique-column name=3D"PERMISSION_NAME"/>
>> </unique>
>>
>> </table>
>>
>> <table name=3D"MYAPP_ROLE" idMethod=3D"idbroker">
>> <column name=3D"ROLE_ID" required=3D"true" primaryKey=3D"true"
>> type=3D"INTEGER"/>
>> <column name=3D"ROLE_NAME" required=3D"true" size=3D"64" =
>type=3D"VARCHAR"
>> javaName=3D"Name"/>
>>
>> <unique>
>> <unique-column name=3D"ROLE_NAME"/>
>> </unique>
>>
>> </table>
>>
>> <table name=3D"MYAPP_GROUP" idMethod=3D"idbroker">
>> <column name=3D"GROUP_ID" required=3D"true" primaryKey=3D"true"
>> type=3D"INTEGER"/>
>> <column name=3D"GROUP_NAME" required=3D"true" type=3D"VARCHAR" =
>size=3D"64"
>> javaName=3D"Name"/>
>>
>> <unique>
>> <unique-column name=3D"GROUP_NAME"/>
>> </unique>
>>
>> </table>
>>
>> <table name=3D"TURBINE_ROLE_PERMISSION">
>> <column name=3D"ROLE_ID" required=3D"true" primaryKey=3D"true"
>> type=3D"INTEGER"/>
>> <column name=3D"PERMISSION_ID" required=3D"true" primaryKey=3D"true"=
>> type=3D"INTEGER"/>
>>
>> <foreign-key foreignTable=3D"MYAPP_ROLE">
>> <reference local=3D"ROLE_ID" foreign=3D"ROLE_ID"/>
>> </foreign-key>
>>
>> <foreign-key foreignTable=3D"MYAPP_PERMISSION">
>> <reference local=3D"PERMISSION_ID" foreign=3D"PERMISSION_ID"/>
>> </foreign-key>
>> </table>
>>
>> <table name=3D"TURBINE_USER_GROUP_ROLE">
>> <column name=3D"USER_ID" required=3D"true" primaryKey=3D"true"
>> type=3D"INTEGER"/>
>> <column name=3D"GROUP_ID" required=3D"true" primaryKey=3D"true"
>> type=3D"INTEGER"/>
>> <column name=3D"ROLE_ID" required=3D"true" primaryKey=3D"true"
>> type=3D"INTEGER"/>
>>
>> <foreign-key foreignTable=3D"MYAPP_USER">
>> <reference local=3D"USER_ID" foreign=3D"USER_ID"/>
>> </foreign-key>
>>
>> <foreign-key foreignTable=3D"MYAPP_GROUP">
>> <reference local=3D"GROUP_ID" foreign=3D"GROUP_ID"/>
>> </foreign-key>
>>
>> <foreign-key foreignTable=3D"MYAPP_ROLE">
>> <reference local=3D"ROLE_ID" foreign=3D"ROLE_ID"/>
>> </foreign-key>
>> </table>
>>
>> </database>
>> --- cut --- myapp-schema.xml ---
>>
>>
>> --- cut --- MyAppUser.java ---
>> package de.intermeta.myapp.security;
>>
>> import org.apache.turbine.services.security.torque.TorqueUser;
>>
>> import de.intermeta.myapp.security.om.MyappUser;
>>
>> public class MyAppUser
>> extends TorqueUser
>> {
>> /**
>> * Constructor.
>> */
>> public MyAppUser()
>> {
>> super();
>> }
>>
>> /**
>> * This Constructor is used when the UserPeerManager
>> * has retrieved a list of Database Objects from the peer and
>> * must 'wrap' them into TorqueRole Objects. You should not use it
>> directly!
>> *
>> * @param obj An Object from the peer
>> */
>> public MyAppUser(Persistent obj)
>> {
>> super(obj);
>> }
>>
>>
>> public int getLanguageId()
>> {
>> return ((MyappUser) getPersistentObj()).getLanguageId();
>> }
>>
>> public void setLanguageId(int languageId)
>> {
>> ((MyappUser) getPersistentObj()).setLanguageId(languageId);
>> }
>>
>> public int getGruppenId()
>> {
>> return ((MyappUser) getPersistentObj()).getGruppenId();
>> }
>>
>> public void setGruppenId(int gruppenId)
>> {
>> ((MyappUser) getPersistentObj()).setGruppenId(gruppenId);
>> }
>> }
>> --- cut --- MyAppUser.java ---
>>
>> - Run the schema, you should get de.intermeta.myapp.security.om.<lots =
>of
>> classes>
>> - add de.intermeta.maxpatch.myapp.security.MyAppUser.java
>> - configure Turbine as described above
>> - create the tables with maven torque:sql, put them into a database (I=20=
>> use
>> PostgreSQL).
>>
>> Insert some data into the tables:
>>
>> --- cut ---
>> INSERT INTO MYAPP_USER
>> (USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
>> VALUES (1,'turbine','turbine','Mr.','Turbine');
>>
>> INSERT INTO MYAPP_PERMISSION (PERMISSION_ID,PERMISSION_NAME)
>> VALUES (1,'Myapp');
>>
>> INSERT INTO MYAPP_ROLE (ROLE_ID,ROLE_NAME)
>> VALUES (1,'MyappAdmin');
>>
>>
>> INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
>> VALUES (1,'global');
>>
>>
>> INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
>> VALUES (2,'Myapp');
>>
>>
>> INSERT INTO TURBINE_ROLE_PERMISSION (ROLE_ID,PERMISSION_ID)
>> VALUES (1,1);
>>
>>
>> INSERT INTO TURBINE_USER_GROUP_ROLE (USER_ID,GROUP_ID,ROLE_ID)
>> VALUES (1,2,1);
>>
>> --- cut ---
>>
>> Now you should be able to log on with user "turbine" , pw "turbine".
>>
>> Regards
>> Henning
>>
>>
>>
>>
>> --
>> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
>> hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
>>
>> Java, perl, Solaris, Linux, xSP Consulting, Web Services
>> freelance consultant -- Jakarta Turbine Development -- hero for hire
>>
>> --- Quote of the week: "It is pointless to tell people anything when
>> you know that they won't process the message." --- Jonathan Revusky
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>>
>>
>>
>___________________________________
>Keith Seim =95 http://kjsdesigns.com
>--Apple-Mail-4--525461840--
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by Keith Seim <ke...@kjsdesigns.com>.
I'm not sure what you mean by "yet they have the same columns and you
have left the
cross tables as the TURBINE supplied ones" I assume you mean that the
tables and columns are still named the same. I'm a newbie, but I have
fiddled and researched and asked about users myself. The point of
keeping TURBINE_USER as-is (without modifying it's name or columns) is
so that you can still use the Security feature:
http://jakarta.apache.org/turbine/turbine-2.2.1/howto/security-howto.html
As seen in the Turbine-User how-to:
http://jakarta.apache.org/turbine/turbine-2.2.1/howto/extend-user-
howto.html (40% down the page, code block "public class
TurbineUserAdapter extends TurbineUser")
The point of extending the user (instead of simply creating your own) is
so that your "user" class is compatible with TurbineUser. If you
alter/delete the table or columns, you'll have to mess with
TurbineUser. If you really need a CUSTOM_USER table, I believe your
options are:
a) add the columns you need to Turbine_User; following the extend-user
how-to,
b) simply FK TURBINE_USER from your own CUSTOM_USER table... then you
can have your cake and eat it too, or
c) throw away the Turbine-Security features altogether.
Hope that helps
Keith
On Thursday, July 3, 2003, at 09:01 AM, David Wynter wrote:
> Hi Henning,
>
> Just trying out your extended user approach below (while killing time
> until
> I can get some advice on this unresolved 'category' generatino problem).
>
> I have a question on the example. You replace the TURBINE_NNN for Group,
> Permission and Role and yet they have the same columns and you have
> left the
> cross tables as the TURBINE supplied ones. Is this because you have to
> or is
> it just for the exercise? In other words, can I just replace
> TURBINE_USER
> with my CUSTOM_USER and continue to use the torque generate TURBINE_NNN
> tables for the others?
>
> regards,
>
> David
>
> -----Original Message-----
> From: Henning P. Schmiedehausen [mailto:hps@intermeta.de]
> Sent: 02 July 2003 14:16
> To: turbine-user@jakarta.apache.org
> Subject: Re: Extending user in T2.3
>
>
> Zamek <za...@vili.pmmf.hu> writes:
>
>> I would like to get a working TR.props file or a part of TR.prop
>
>> for compensation, I will correct, and comment the documentation.
>
> Ok, the following is cut life out of the application running in the
> window behind this one...
>
> --- cut ---
> services.SecurityService.classname=org.apache.turbine.services.security.torq
> ue.TorqueSecurityService
> [...]
> # -------------------------------------------------------------------
> #
> # S E C U R I T Y S E R V I C E
> #
> # -------------------------------------------------------------------
>
> # Default: org.apache.turbine.services.security.db.DBUserManager
> services.SecurityService.user.manager =
> org.apache.turbine.services.security.torque.TorqueUserManager
>
> # This is the class that implements the ACL interface.
> services.SecurityService.acl.class =
> org.apache.turbine.util.security.TurbineAccessControlList
>
> #
> # Configure Object Classes in the Security Service
> #
>
> # Custom User
> services.SecurityService.user.class =
> de.intermeta.myapp.security.MyAppUser
>
> services.SecurityService.group.class =
> org.apache.turbine.services.security.torque.TorqueGroup
> services.SecurityService.permission.class =
> org.apache.turbine.services.security.torque.TorquePermission
> services.SecurityService.role.class =
> org.apache.turbine.services.security.torque.TorqueRole
>
> #
> # Configure Peers for the Torque Security Service
> #
> services.SecurityService.torque.userPeer.class =
> de.intermeta.myapp.security.om.MyappUserPeer
> services.SecurityService.torque.groupPeer.class =
> de.intermeta.myapp.security.om.MyappGroupPeer
> services.SecurityService.torque.permissionPeer.class =
> de.intermeta.myapp.security.om.MyappPermissionPeer
> services.SecurityService.torque.rolePeer.class =
> de.intermeta.myapp.security.om.MyappRolePeer
>
> [...]
>
> --- cut ---
>
> --- cut --- myapp-schema.xml ---
> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
> <!DOCTYPE database SYSTEM
> "http://jakarta.apache.org/turbine/dtd/database_3_1.dtd">
>
> <database name="myapp"
> defaultIdMethod="idbroker"
> defaultJavaType="primitive"
> defaultJavaNamingMethod="underscore"
> package="de.intermeta.myapp.security.om">
>
> <table name="MYAPP_USER" idMethod="idbroker">
> <column name="USER_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="LOGIN_NAME" required="true" size="64" type="VARCHAR"
> javaName="UserName"/>
> <column name="PASSWORD_VALUE" required="true" size="16"
> type="VARCHAR"
> javaName="Password"/>
> <column name="FIRST_NAME" required="true" size="64" type="VARCHAR"/>
> <column name="LAST_NAME" required="true" size="64" type="VARCHAR"/>
> <column name="EMAIL" size="64" type="VARCHAR"/>
> <column name="CONFIRM_VALUE" size="16" type="VARCHAR"
> javaName="Confirmed"/>
> <column name="MODIFIED" type="TIMESTAMP" size="0"/>
> <column name="CREATED" type="TIMESTAMP" size="0"
> javaName="CreateDate"/>
> <column name="LAST_LOGIN" type="TIMESTAMP" size="0"/>
> <column name="OBJECTDATA" type="VARBINARY"/>
>
> <!-- Myapp Erweiterungen -->
>
> <!-- Aktuell ausgewaehlte Sprachversion -->
> <column name="MYAPP_LANGUAGE_ID" type="INTEGER"
> javaName="LanguageId"/>
> <!-- Aktuell ausgewaehlte Gruppe -->
> <column name="MYAPP_GRUPPEN_ID" type="INTEGER"
> javaName="GruppenId"/>
>
> <unique>
> <unique-column name="LOGIN_NAME"/>
> </unique>
>
> </table>
>
> <table name="MYAPP_PERMISSION" idMethod="idbroker">
> <column name="PERMISSION_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="PERMISSION_NAME" required="true" size="64"
> type="VARCHAR"
> javaName="Name"/>
>
> <unique>
> <unique-column name="PERMISSION_NAME"/>
> </unique>
>
> </table>
>
> <table name="MYAPP_ROLE" idMethod="idbroker">
> <column name="ROLE_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="ROLE_NAME" required="true" size="64" type="VARCHAR"
> javaName="Name"/>
>
> <unique>
> <unique-column name="ROLE_NAME"/>
> </unique>
>
> </table>
>
> <table name="MYAPP_GROUP" idMethod="idbroker">
> <column name="GROUP_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="GROUP_NAME" required="true" type="VARCHAR" size="64"
> javaName="Name"/>
>
> <unique>
> <unique-column name="GROUP_NAME"/>
> </unique>
>
> </table>
>
> <table name="TURBINE_ROLE_PERMISSION">
> <column name="ROLE_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="PERMISSION_ID" required="true" primaryKey="true"
> type="INTEGER"/>
>
> <foreign-key foreignTable="MYAPP_ROLE">
> <reference local="ROLE_ID" foreign="ROLE_ID"/>
> </foreign-key>
>
> <foreign-key foreignTable="MYAPP_PERMISSION">
> <reference local="PERMISSION_ID" foreign="PERMISSION_ID"/>
> </foreign-key>
> </table>
>
> <table name="TURBINE_USER_GROUP_ROLE">
> <column name="USER_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="GROUP_ID" required="true" primaryKey="true"
> type="INTEGER"/>
> <column name="ROLE_ID" required="true" primaryKey="true"
> type="INTEGER"/>
>
> <foreign-key foreignTable="MYAPP_USER">
> <reference local="USER_ID" foreign="USER_ID"/>
> </foreign-key>
>
> <foreign-key foreignTable="MYAPP_GROUP">
> <reference local="GROUP_ID" foreign="GROUP_ID"/>
> </foreign-key>
>
> <foreign-key foreignTable="MYAPP_ROLE">
> <reference local="ROLE_ID" foreign="ROLE_ID"/>
> </foreign-key>
> </table>
>
> </database>
> --- cut --- myapp-schema.xml ---
>
>
> --- cut --- MyAppUser.java ---
> package de.intermeta.myapp.security;
>
> import org.apache.turbine.services.security.torque.TorqueUser;
>
> import de.intermeta.myapp.security.om.MyappUser;
>
> public class MyAppUser
> extends TorqueUser
> {
> /**
> * Constructor.
> */
> public MyAppUser()
> {
> super();
> }
>
> /**
> * This Constructor is used when the UserPeerManager
> * has retrieved a list of Database Objects from the peer and
> * must 'wrap' them into TorqueRole Objects. You should not use it
> directly!
> *
> * @param obj An Object from the peer
> */
> public MyAppUser(Persistent obj)
> {
> super(obj);
> }
>
>
> public int getLanguageId()
> {
> return ((MyappUser) getPersistentObj()).getLanguageId();
> }
>
> public void setLanguageId(int languageId)
> {
> ((MyappUser) getPersistentObj()).setLanguageId(languageId);
> }
>
> public int getGruppenId()
> {
> return ((MyappUser) getPersistentObj()).getGruppenId();
> }
>
> public void setGruppenId(int gruppenId)
> {
> ((MyappUser) getPersistentObj()).setGruppenId(gruppenId);
> }
> }
> --- cut --- MyAppUser.java ---
>
> - Run the schema, you should get de.intermeta.myapp.security.om.<lots of
> classes>
> - add de.intermeta.maxpatch.myapp.security.MyAppUser.java
> - configure Turbine as described above
> - create the tables with maven torque:sql, put them into a database (I
> use
> PostgreSQL).
>
> Insert some data into the tables:
>
> --- cut ---
> INSERT INTO MYAPP_USER
> (USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
> VALUES (1,'turbine','turbine','Mr.','Turbine');
>
> INSERT INTO MYAPP_PERMISSION (PERMISSION_ID,PERMISSION_NAME)
> VALUES (1,'Myapp');
>
> INSERT INTO MYAPP_ROLE (ROLE_ID,ROLE_NAME)
> VALUES (1,'MyappAdmin');
>
>
> INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
> VALUES (1,'global');
>
>
> INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
> VALUES (2,'Myapp');
>
>
> INSERT INTO TURBINE_ROLE_PERMISSION (ROLE_ID,PERMISSION_ID)
> VALUES (1,1);
>
>
> INSERT INTO TURBINE_USER_GROUP_ROLE (USER_ID,GROUP_ID,ROLE_ID)
> VALUES (1,2,1);
>
> --- cut ---
>
> Now you should be able to log on with user "turbine" , pw "turbine".
>
> Regards
> Henning
>
>
>
>
> --
> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
> hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
>
> Java, perl, Solaris, Linux, xSP Consulting, Web Services
> freelance consultant -- Jakarta Turbine Development -- hero for hire
>
> --- Quote of the week: "It is pointless to tell people anything when
> you know that they won't process the message." --- Jonathan Revusky
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>
>
___________________________________
Keith Seim • http://kjsdesigns.com
RE: Extending user in T2.3
Posted by David Wynter <da...@roamware.co.uk>.
Hi Henning,
Just trying out your extended user approach below (while killing time until
I can get some advice on this unresolved 'category' generatino problem).
I have a question on the example. You replace the TURBINE_NNN for Group,
Permission and Role and yet they have the same columns and you have left the
cross tables as the TURBINE supplied ones. Is this because you have to or is
it just for the exercise? In other words, can I just replace TURBINE_USER
with my CUSTOM_USER and continue to use the torque generate TURBINE_NNN
tables for the others?
regards,
David
-----Original Message-----
From: Henning P. Schmiedehausen [mailto:hps@intermeta.de]
Sent: 02 July 2003 14:16
To: turbine-user@jakarta.apache.org
Subject: Re: Extending user in T2.3
Zamek <za...@vili.pmmf.hu> writes:
>I would like to get a working TR.props file or a part of TR.prop
>for compensation, I will correct, and comment the documentation.
Ok, the following is cut life out of the application running in the
window behind this one...
--- cut ---
services.SecurityService.classname=org.apache.turbine.services.security.torq
ue.TorqueSecurityService
[...]
# -------------------------------------------------------------------
#
# S E C U R I T Y S E R V I C E
#
# -------------------------------------------------------------------
# Default: org.apache.turbine.services.security.db.DBUserManager
services.SecurityService.user.manager =
org.apache.turbine.services.security.torque.TorqueUserManager
# This is the class that implements the ACL interface.
services.SecurityService.acl.class =
org.apache.turbine.util.security.TurbineAccessControlList
#
# Configure Object Classes in the Security Service
#
# Custom User
services.SecurityService.user.class = de.intermeta.myapp.security.MyAppUser
services.SecurityService.group.class =
org.apache.turbine.services.security.torque.TorqueGroup
services.SecurityService.permission.class =
org.apache.turbine.services.security.torque.TorquePermission
services.SecurityService.role.class =
org.apache.turbine.services.security.torque.TorqueRole
#
# Configure Peers for the Torque Security Service
#
services.SecurityService.torque.userPeer.class =
de.intermeta.myapp.security.om.MyappUserPeer
services.SecurityService.torque.groupPeer.class =
de.intermeta.myapp.security.om.MyappGroupPeer
services.SecurityService.torque.permissionPeer.class =
de.intermeta.myapp.security.om.MyappPermissionPeer
services.SecurityService.torque.rolePeer.class =
de.intermeta.myapp.security.om.MyappRolePeer
[...]
--- cut ---
--- cut --- myapp-schema.xml ---
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE database SYSTEM
"http://jakarta.apache.org/turbine/dtd/database_3_1.dtd">
<database name="myapp"
defaultIdMethod="idbroker"
defaultJavaType="primitive"
defaultJavaNamingMethod="underscore"
package="de.intermeta.myapp.security.om">
<table name="MYAPP_USER" idMethod="idbroker">
<column name="USER_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="LOGIN_NAME" required="true" size="64" type="VARCHAR"
javaName="UserName"/>
<column name="PASSWORD_VALUE" required="true" size="16" type="VARCHAR"
javaName="Password"/>
<column name="FIRST_NAME" required="true" size="64" type="VARCHAR"/>
<column name="LAST_NAME" required="true" size="64" type="VARCHAR"/>
<column name="EMAIL" size="64" type="VARCHAR"/>
<column name="CONFIRM_VALUE" size="16" type="VARCHAR"
javaName="Confirmed"/>
<column name="MODIFIED" type="TIMESTAMP" size="0"/>
<column name="CREATED" type="TIMESTAMP" size="0" javaName="CreateDate"/>
<column name="LAST_LOGIN" type="TIMESTAMP" size="0"/>
<column name="OBJECTDATA" type="VARBINARY"/>
<!-- Myapp Erweiterungen -->
<!-- Aktuell ausgewaehlte Sprachversion -->
<column name="MYAPP_LANGUAGE_ID" type="INTEGER" javaName="LanguageId"/>
<!-- Aktuell ausgewaehlte Gruppe -->
<column name="MYAPP_GRUPPEN_ID" type="INTEGER" javaName="GruppenId"/>
<unique>
<unique-column name="LOGIN_NAME"/>
</unique>
</table>
<table name="MYAPP_PERMISSION" idMethod="idbroker">
<column name="PERMISSION_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="PERMISSION_NAME" required="true" size="64" type="VARCHAR"
javaName="Name"/>
<unique>
<unique-column name="PERMISSION_NAME"/>
</unique>
</table>
<table name="MYAPP_ROLE" idMethod="idbroker">
<column name="ROLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="ROLE_NAME" required="true" size="64" type="VARCHAR"
javaName="Name"/>
<unique>
<unique-column name="ROLE_NAME"/>
</unique>
</table>
<table name="MYAPP_GROUP" idMethod="idbroker">
<column name="GROUP_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="GROUP_NAME" required="true" type="VARCHAR" size="64"
javaName="Name"/>
<unique>
<unique-column name="GROUP_NAME"/>
</unique>
</table>
<table name="TURBINE_ROLE_PERMISSION">
<column name="ROLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="PERMISSION_ID" required="true" primaryKey="true"
type="INTEGER"/>
<foreign-key foreignTable="MYAPP_ROLE">
<reference local="ROLE_ID" foreign="ROLE_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_PERMISSION">
<reference local="PERMISSION_ID" foreign="PERMISSION_ID"/>
</foreign-key>
</table>
<table name="TURBINE_USER_GROUP_ROLE">
<column name="USER_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="GROUP_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="ROLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
<foreign-key foreignTable="MYAPP_USER">
<reference local="USER_ID" foreign="USER_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_GROUP">
<reference local="GROUP_ID" foreign="GROUP_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_ROLE">
<reference local="ROLE_ID" foreign="ROLE_ID"/>
</foreign-key>
</table>
</database>
--- cut --- myapp-schema.xml ---
--- cut --- MyAppUser.java ---
package de.intermeta.myapp.security;
import org.apache.turbine.services.security.torque.TorqueUser;
import de.intermeta.myapp.security.om.MyappUser;
public class MyAppUser
extends TorqueUser
{
/**
* Constructor.
*/
public MyAppUser()
{
super();
}
/**
* This Constructor is used when the UserPeerManager
* has retrieved a list of Database Objects from the peer and
* must 'wrap' them into TorqueRole Objects. You should not use it
directly!
*
* @param obj An Object from the peer
*/
public MyAppUser(Persistent obj)
{
super(obj);
}
public int getLanguageId()
{
return ((MyappUser) getPersistentObj()).getLanguageId();
}
public void setLanguageId(int languageId)
{
((MyappUser) getPersistentObj()).setLanguageId(languageId);
}
public int getGruppenId()
{
return ((MyappUser) getPersistentObj()).getGruppenId();
}
public void setGruppenId(int gruppenId)
{
((MyappUser) getPersistentObj()).setGruppenId(gruppenId);
}
}
--- cut --- MyAppUser.java ---
- Run the schema, you should get de.intermeta.myapp.security.om.<lots of
classes>
- add de.intermeta.maxpatch.myapp.security.MyAppUser.java
- configure Turbine as described above
- create the tables with maven torque:sql, put them into a database (I use
PostgreSQL).
Insert some data into the tables:
--- cut ---
INSERT INTO MYAPP_USER
(USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
VALUES (1,'turbine','turbine','Mr.','Turbine');
INSERT INTO MYAPP_PERMISSION (PERMISSION_ID,PERMISSION_NAME)
VALUES (1,'Myapp');
INSERT INTO MYAPP_ROLE (ROLE_ID,ROLE_NAME)
VALUES (1,'MyappAdmin');
INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
VALUES (1,'global');
INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
VALUES (2,'Myapp');
INSERT INTO TURBINE_ROLE_PERMISSION (ROLE_ID,PERMISSION_ID)
VALUES (1,1);
INSERT INTO TURBINE_USER_GROUP_ROLE (USER_ID,GROUP_ID,ROLE_ID)
VALUES (1,2,1);
--- cut ---
Now you should be able to log on with user "turbine" , pw "turbine".
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
RE: Extending user in T2.3
Posted by David Wynter <da...@roamware.co.uk>.
Another quick question on the example below.
Assuming the schema below goes into your
"package="de.intermeta.myapp.security.om"" package and you have your
application om classes in say "package="de.intermeta.myapp.om"" then how do
you reference your MYAPP_USER as a foreign key in ylour application schema
xml file
i.e. in a table specification in your application schema declaration you
have
<foreign-key foreignTable="MYAPP_USER">
<reference local="creator_id" foreign="USER_ID"/>
</foreign-key>
Will this work?
Thanks
David
-----Original Message-----
From: Henning P. Schmiedehausen [mailto:hps@intermeta.de]
Sent: 02 July 2003 14:16
To: turbine-user@jakarta.apache.org
Subject: Re: Extending user in T2.3
Zamek <za...@vili.pmmf.hu> writes:
>I would like to get a working TR.props file or a part of TR.prop
>for compensation, I will correct, and comment the documentation.
Ok, the following is cut life out of the application running in the
window behind this one...
--- cut ---
services.SecurityService.classname=org.apache.turbine.services.security.torq
ue.TorqueSecurityService
[...]
# -------------------------------------------------------------------
#
# S E C U R I T Y S E R V I C E
#
# -------------------------------------------------------------------
# Default: org.apache.turbine.services.security.db.DBUserManager
services.SecurityService.user.manager =
org.apache.turbine.services.security.torque.TorqueUserManager
# This is the class that implements the ACL interface.
services.SecurityService.acl.class =
org.apache.turbine.util.security.TurbineAccessControlList
#
# Configure Object Classes in the Security Service
#
# Custom User
services.SecurityService.user.class = de.intermeta.myapp.security.MyAppUser
services.SecurityService.group.class =
org.apache.turbine.services.security.torque.TorqueGroup
services.SecurityService.permission.class =
org.apache.turbine.services.security.torque.TorquePermission
services.SecurityService.role.class =
org.apache.turbine.services.security.torque.TorqueRole
#
# Configure Peers for the Torque Security Service
#
services.SecurityService.torque.userPeer.class =
de.intermeta.myapp.security.om.MyappUserPeer
services.SecurityService.torque.groupPeer.class =
de.intermeta.myapp.security.om.MyappGroupPeer
services.SecurityService.torque.permissionPeer.class =
de.intermeta.myapp.security.om.MyappPermissionPeer
services.SecurityService.torque.rolePeer.class =
de.intermeta.myapp.security.om.MyappRolePeer
[...]
--- cut ---
--- cut --- myapp-schema.xml ---
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE database SYSTEM
"http://jakarta.apache.org/turbine/dtd/database_3_1.dtd">
<database name="myapp"
defaultIdMethod="idbroker"
defaultJavaType="primitive"
defaultJavaNamingMethod="underscore"
package="de.intermeta.myapp.security.om">
<table name="MYAPP_USER" idMethod="idbroker">
<column name="USER_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="LOGIN_NAME" required="true" size="64" type="VARCHAR"
javaName="UserName"/>
<column name="PASSWORD_VALUE" required="true" size="16" type="VARCHAR"
javaName="Password"/>
<column name="FIRST_NAME" required="true" size="64" type="VARCHAR"/>
<column name="LAST_NAME" required="true" size="64" type="VARCHAR"/>
<column name="EMAIL" size="64" type="VARCHAR"/>
<column name="CONFIRM_VALUE" size="16" type="VARCHAR"
javaName="Confirmed"/>
<column name="MODIFIED" type="TIMESTAMP" size="0"/>
<column name="CREATED" type="TIMESTAMP" size="0" javaName="CreateDate"/>
<column name="LAST_LOGIN" type="TIMESTAMP" size="0"/>
<column name="OBJECTDATA" type="VARBINARY"/>
<!-- Myapp Erweiterungen -->
<!-- Aktuell ausgewaehlte Sprachversion -->
<column name="MYAPP_LANGUAGE_ID" type="INTEGER" javaName="LanguageId"/>
<!-- Aktuell ausgewaehlte Gruppe -->
<column name="MYAPP_GRUPPEN_ID" type="INTEGER" javaName="GruppenId"/>
<unique>
<unique-column name="LOGIN_NAME"/>
</unique>
</table>
<table name="MYAPP_PERMISSION" idMethod="idbroker">
<column name="PERMISSION_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="PERMISSION_NAME" required="true" size="64" type="VARCHAR"
javaName="Name"/>
<unique>
<unique-column name="PERMISSION_NAME"/>
</unique>
</table>
<table name="MYAPP_ROLE" idMethod="idbroker">
<column name="ROLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="ROLE_NAME" required="true" size="64" type="VARCHAR"
javaName="Name"/>
<unique>
<unique-column name="ROLE_NAME"/>
</unique>
</table>
<table name="MYAPP_GROUP" idMethod="idbroker">
<column name="GROUP_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="GROUP_NAME" required="true" type="VARCHAR" size="64"
javaName="Name"/>
<unique>
<unique-column name="GROUP_NAME"/>
</unique>
</table>
<table name="TURBINE_ROLE_PERMISSION">
<column name="ROLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="PERMISSION_ID" required="true" primaryKey="true"
type="INTEGER"/>
<foreign-key foreignTable="MYAPP_ROLE">
<reference local="ROLE_ID" foreign="ROLE_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_PERMISSION">
<reference local="PERMISSION_ID" foreign="PERMISSION_ID"/>
</foreign-key>
</table>
<table name="TURBINE_USER_GROUP_ROLE">
<column name="USER_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="GROUP_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="ROLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
<foreign-key foreignTable="MYAPP_USER">
<reference local="USER_ID" foreign="USER_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_GROUP">
<reference local="GROUP_ID" foreign="GROUP_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_ROLE">
<reference local="ROLE_ID" foreign="ROLE_ID"/>
</foreign-key>
</table>
</database>
--- cut --- myapp-schema.xml ---
--- cut --- MyAppUser.java ---
package de.intermeta.myapp.security;
import org.apache.turbine.services.security.torque.TorqueUser;
import de.intermeta.myapp.security.om.MyappUser;
public class MyAppUser
extends TorqueUser
{
/**
* Constructor.
*/
public MyAppUser()
{
super();
}
/**
* This Constructor is used when the UserPeerManager
* has retrieved a list of Database Objects from the peer and
* must 'wrap' them into TorqueRole Objects. You should not use it
directly!
*
* @param obj An Object from the peer
*/
public MyAppUser(Persistent obj)
{
super(obj);
}
public int getLanguageId()
{
return ((MyappUser) getPersistentObj()).getLanguageId();
}
public void setLanguageId(int languageId)
{
((MyappUser) getPersistentObj()).setLanguageId(languageId);
}
public int getGruppenId()
{
return ((MyappUser) getPersistentObj()).getGruppenId();
}
public void setGruppenId(int gruppenId)
{
((MyappUser) getPersistentObj()).setGruppenId(gruppenId);
}
}
--- cut --- MyAppUser.java ---
- Run the schema, you should get de.intermeta.myapp.security.om.<lots of
classes>
- add de.intermeta.maxpatch.myapp.security.MyAppUser.java
- configure Turbine as described above
- create the tables with maven torque:sql, put them into a database (I use
PostgreSQL).
Insert some data into the tables:
--- cut ---
INSERT INTO MYAPP_USER
(USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
VALUES (1,'turbine','turbine','Mr.','Turbine');
INSERT INTO MYAPP_PERMISSION (PERMISSION_ID,PERMISSION_NAME)
VALUES (1,'Myapp');
INSERT INTO MYAPP_ROLE (ROLE_ID,ROLE_NAME)
VALUES (1,'MyappAdmin');
INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
VALUES (1,'global');
INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
VALUES (2,'Myapp');
INSERT INTO TURBINE_ROLE_PERMISSION (ROLE_ID,PERMISSION_ID)
VALUES (1,1);
INSERT INTO TURBINE_USER_GROUP_ROLE (USER_ID,GROUP_ID,ROLE_ID)
VALUES (1,2,1);
--- cut ---
Now you should be able to log on with user "turbine" , pw "turbine".
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
RE: Extending user in T2.3
Posted by David Wynter <da...@roamware.co.uk>.
Hi Henning,
Just a point of clarification on the changes to extend TurbineUser in
T2.3-dev below.
Below you have your extension classes in the package
"de.intermeta.myapp.security.om" and in a later email to the list you said I
could not reference via foreign key the extended user table unless it was
all in one *-schema.xml file. Does this mean you have all your application
classes in the *.security.om package (!?) as well as the security specific
ones?.
The other problem I have is that if the extended Myapp user table definition
is in your project-schema.xml file and is used to generate the MyappUser and
MyappUserPeer java source then how do you get it to implement the
org.apache.turbine.om.security.peer.UserPeer interface as shown this excerpt
from the tr.props section here
http://jakarta.apache.org/turbine/turbine-2.3/services/security-service.html
:
This is the relevant bit
# This setting is DBSecurityService specific - this class is consulted for
the names
# of the columns in the users' tables for the purpose of creating join
queries.
# If you use your own User implementation in conjunction with
DBSecurityService,
# it's peer class must implement
org.apache.turbine.om.security.peer.UserPeer interface,
# and you need to specify the name of the peer class here.
#
# Default: org.apache.turbine.om.security.peer.TurbineUserPeer
#
services.SecurityService.userPeer.class=org.apache.turbine.om.security.peer.
TurbineUserPeer
Thanks.
David
-----Original Message-----
From: Henning P. Schmiedehausen [mailto:hps@intermeta.de]
Sent: 02 July 2003 14:16
To: turbine-user@jakarta.apache.org
Subject: Re: Extending user in T2.3
Zamek <za...@vili.pmmf.hu> writes:
>I would like to get a working TR.props file or a part of TR.prop
>for compensation, I will correct, and comment the documentation.
Ok, the following is cut life out of the application running in the
window behind this one...
--- cut ---
services.SecurityService.classname=org.apache.turbine.services.security.torq
ue.TorqueSecurityService
[...]
# -------------------------------------------------------------------
#
# S E C U R I T Y S E R V I C E
#
# -------------------------------------------------------------------
# Default: org.apache.turbine.services.security.db.DBUserManager
services.SecurityService.user.manager =
org.apache.turbine.services.security.torque.TorqueUserManager
# This is the class that implements the ACL interface.
services.SecurityService.acl.class =
org.apache.turbine.util.security.TurbineAccessControlList
#
# Configure Object Classes in the Security Service
#
# Custom User
services.SecurityService.user.class = de.intermeta.myapp.security.MyAppUser
services.SecurityService.group.class =
org.apache.turbine.services.security.torque.TorqueGroup
services.SecurityService.permission.class =
org.apache.turbine.services.security.torque.TorquePermission
services.SecurityService.role.class =
org.apache.turbine.services.security.torque.TorqueRole
#
# Configure Peers for the Torque Security Service
#
services.SecurityService.torque.userPeer.class =
de.intermeta.myapp.security.om.MyappUserPeer
services.SecurityService.torque.groupPeer.class =
de.intermeta.myapp.security.om.MyappGroupPeer
services.SecurityService.torque.permissionPeer.class =
de.intermeta.myapp.security.om.MyappPermissionPeer
services.SecurityService.torque.rolePeer.class =
de.intermeta.myapp.security.om.MyappRolePeer
[...]
--- cut ---
--- cut --- myapp-schema.xml ---
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE database SYSTEM
"http://jakarta.apache.org/turbine/dtd/database_3_1.dtd">
<database name="myapp"
defaultIdMethod="idbroker"
defaultJavaType="primitive"
defaultJavaNamingMethod="underscore"
package="de.intermeta.myapp.security.om">
<table name="MYAPP_USER" idMethod="idbroker">
<column name="USER_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="LOGIN_NAME" required="true" size="64" type="VARCHAR"
javaName="UserName"/>
<column name="PASSWORD_VALUE" required="true" size="16" type="VARCHAR"
javaName="Password"/>
<column name="FIRST_NAME" required="true" size="64" type="VARCHAR"/>
<column name="LAST_NAME" required="true" size="64" type="VARCHAR"/>
<column name="EMAIL" size="64" type="VARCHAR"/>
<column name="CONFIRM_VALUE" size="16" type="VARCHAR"
javaName="Confirmed"/>
<column name="MODIFIED" type="TIMESTAMP" size="0"/>
<column name="CREATED" type="TIMESTAMP" size="0" javaName="CreateDate"/>
<column name="LAST_LOGIN" type="TIMESTAMP" size="0"/>
<column name="OBJECTDATA" type="VARBINARY"/>
<!-- Myapp Erweiterungen -->
<!-- Aktuell ausgewaehlte Sprachversion -->
<column name="MYAPP_LANGUAGE_ID" type="INTEGER" javaName="LanguageId"/>
<!-- Aktuell ausgewaehlte Gruppe -->
<column name="MYAPP_GRUPPEN_ID" type="INTEGER" javaName="GruppenId"/>
<unique>
<unique-column name="LOGIN_NAME"/>
</unique>
</table>
<table name="MYAPP_PERMISSION" idMethod="idbroker">
<column name="PERMISSION_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="PERMISSION_NAME" required="true" size="64" type="VARCHAR"
javaName="Name"/>
<unique>
<unique-column name="PERMISSION_NAME"/>
</unique>
</table>
<table name="MYAPP_ROLE" idMethod="idbroker">
<column name="ROLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="ROLE_NAME" required="true" size="64" type="VARCHAR"
javaName="Name"/>
<unique>
<unique-column name="ROLE_NAME"/>
</unique>
</table>
<table name="MYAPP_GROUP" idMethod="idbroker">
<column name="GROUP_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="GROUP_NAME" required="true" type="VARCHAR" size="64"
javaName="Name"/>
<unique>
<unique-column name="GROUP_NAME"/>
</unique>
</table>
<table name="TURBINE_ROLE_PERMISSION">
<column name="ROLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="PERMISSION_ID" required="true" primaryKey="true"
type="INTEGER"/>
<foreign-key foreignTable="MYAPP_ROLE">
<reference local="ROLE_ID" foreign="ROLE_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_PERMISSION">
<reference local="PERMISSION_ID" foreign="PERMISSION_ID"/>
</foreign-key>
</table>
<table name="TURBINE_USER_GROUP_ROLE">
<column name="USER_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="GROUP_ID" required="true" primaryKey="true"
type="INTEGER"/>
<column name="ROLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
<foreign-key foreignTable="MYAPP_USER">
<reference local="USER_ID" foreign="USER_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_GROUP">
<reference local="GROUP_ID" foreign="GROUP_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_ROLE">
<reference local="ROLE_ID" foreign="ROLE_ID"/>
</foreign-key>
</table>
</database>
--- cut --- myapp-schema.xml ---
--- cut --- MyAppUser.java ---
package de.intermeta.myapp.security;
import org.apache.turbine.services.security.torque.TorqueUser;
import de.intermeta.myapp.security.om.MyappUser;
public class MyAppUser
extends TorqueUser
{
/**
* Constructor.
*/
public MyAppUser()
{
super();
}
/**
* This Constructor is used when the UserPeerManager
* has retrieved a list of Database Objects from the peer and
* must 'wrap' them into TorqueRole Objects. You should not use it
directly!
*
* @param obj An Object from the peer
*/
public MyAppUser(Persistent obj)
{
super(obj);
}
public int getLanguageId()
{
return ((MyappUser) getPersistentObj()).getLanguageId();
}
public void setLanguageId(int languageId)
{
((MyappUser) getPersistentObj()).setLanguageId(languageId);
}
public int getGruppenId()
{
return ((MyappUser) getPersistentObj()).getGruppenId();
}
public void setGruppenId(int gruppenId)
{
((MyappUser) getPersistentObj()).setGruppenId(gruppenId);
}
}
--- cut --- MyAppUser.java ---
- Run the schema, you should get de.intermeta.myapp.security.om.<lots of
classes>
- add de.intermeta.maxpatch.myapp.security.MyAppUser.java
- configure Turbine as described above
- create the tables with maven torque:sql, put them into a database (I use
PostgreSQL).
Insert some data into the tables:
--- cut ---
INSERT INTO MYAPP_USER
(USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
VALUES (1,'turbine','turbine','Mr.','Turbine');
INSERT INTO MYAPP_PERMISSION (PERMISSION_ID,PERMISSION_NAME)
VALUES (1,'Myapp');
INSERT INTO MYAPP_ROLE (ROLE_ID,ROLE_NAME)
VALUES (1,'MyappAdmin');
INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
VALUES (1,'global');
INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
VALUES (2,'Myapp');
INSERT INTO TURBINE_ROLE_PERMISSION (ROLE_ID,PERMISSION_ID)
VALUES (1,1);
INSERT INTO TURBINE_USER_GROUP_ROLE (USER_ID,GROUP_ID,ROLE_ID)
VALUES (1,2,1);
--- cut ---
Now you should be able to log on with user "turbine" , pw "turbine".
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Zamek <za...@vili.pmmf.hu> writes:
>I would like to get a working TR.props file or a part of TR.prop
>for compensation, I will correct, and comment the documentation.
Ok, the following is cut life out of the application running in the
window behind this one...
--- cut ---
services.SecurityService.classname=org.apache.turbine.services.security.torque.TorqueSecurityService
[...]
# -------------------------------------------------------------------
#
# S E C U R I T Y S E R V I C E
#
# -------------------------------------------------------------------
# Default: org.apache.turbine.services.security.db.DBUserManager
services.SecurityService.user.manager = org.apache.turbine.services.security.torque.TorqueUserManager
# This is the class that implements the ACL interface.
services.SecurityService.acl.class = org.apache.turbine.util.security.TurbineAccessControlList
#
# Configure Object Classes in the Security Service
#
# Custom User
services.SecurityService.user.class = de.intermeta.myapp.security.MyAppUser
services.SecurityService.group.class = org.apache.turbine.services.security.torque.TorqueGroup
services.SecurityService.permission.class = org.apache.turbine.services.security.torque.TorquePermission
services.SecurityService.role.class = org.apache.turbine.services.security.torque.TorqueRole
#
# Configure Peers for the Torque Security Service
#
services.SecurityService.torque.userPeer.class = de.intermeta.myapp.security.om.MyappUserPeer
services.SecurityService.torque.groupPeer.class = de.intermeta.myapp.security.om.MyappGroupPeer
services.SecurityService.torque.permissionPeer.class = de.intermeta.myapp.security.om.MyappPermissionPeer
services.SecurityService.torque.rolePeer.class = de.intermeta.myapp.security.om.MyappRolePeer
[...]
--- cut ---
--- cut --- myapp-schema.xml ---
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE database SYSTEM "http://jakarta.apache.org/turbine/dtd/database_3_1.dtd">
<database name="myapp"
defaultIdMethod="idbroker"
defaultJavaType="primitive"
defaultJavaNamingMethod="underscore"
package="de.intermeta.myapp.security.om">
<table name="MYAPP_USER" idMethod="idbroker">
<column name="USER_ID" required="true" primaryKey="true" type="INTEGER"/>
<column name="LOGIN_NAME" required="true" size="64" type="VARCHAR" javaName="UserName"/>
<column name="PASSWORD_VALUE" required="true" size="16" type="VARCHAR" javaName="Password"/>
<column name="FIRST_NAME" required="true" size="64" type="VARCHAR"/>
<column name="LAST_NAME" required="true" size="64" type="VARCHAR"/>
<column name="EMAIL" size="64" type="VARCHAR"/>
<column name="CONFIRM_VALUE" size="16" type="VARCHAR" javaName="Confirmed"/>
<column name="MODIFIED" type="TIMESTAMP" size="0"/>
<column name="CREATED" type="TIMESTAMP" size="0" javaName="CreateDate"/>
<column name="LAST_LOGIN" type="TIMESTAMP" size="0"/>
<column name="OBJECTDATA" type="VARBINARY"/>
<!-- Myapp Erweiterungen -->
<!-- Aktuell ausgewaehlte Sprachversion -->
<column name="MYAPP_LANGUAGE_ID" type="INTEGER" javaName="LanguageId"/>
<!-- Aktuell ausgewaehlte Gruppe -->
<column name="MYAPP_GRUPPEN_ID" type="INTEGER" javaName="GruppenId"/>
<unique>
<unique-column name="LOGIN_NAME"/>
</unique>
</table>
<table name="MYAPP_PERMISSION" idMethod="idbroker">
<column name="PERMISSION_ID" required="true" primaryKey="true" type="INTEGER"/>
<column name="PERMISSION_NAME" required="true" size="64" type="VARCHAR" javaName="Name"/>
<unique>
<unique-column name="PERMISSION_NAME"/>
</unique>
</table>
<table name="MYAPP_ROLE" idMethod="idbroker">
<column name="ROLE_ID" required="true" primaryKey="true" type="INTEGER"/>
<column name="ROLE_NAME" required="true" size="64" type="VARCHAR" javaName="Name"/>
<unique>
<unique-column name="ROLE_NAME"/>
</unique>
</table>
<table name="MYAPP_GROUP" idMethod="idbroker">
<column name="GROUP_ID" required="true" primaryKey="true" type="INTEGER"/>
<column name="GROUP_NAME" required="true" type="VARCHAR" size="64" javaName="Name"/>
<unique>
<unique-column name="GROUP_NAME"/>
</unique>
</table>
<table name="TURBINE_ROLE_PERMISSION">
<column name="ROLE_ID" required="true" primaryKey="true" type="INTEGER"/>
<column name="PERMISSION_ID" required="true" primaryKey="true" type="INTEGER"/>
<foreign-key foreignTable="MYAPP_ROLE">
<reference local="ROLE_ID" foreign="ROLE_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_PERMISSION">
<reference local="PERMISSION_ID" foreign="PERMISSION_ID"/>
</foreign-key>
</table>
<table name="TURBINE_USER_GROUP_ROLE">
<column name="USER_ID" required="true" primaryKey="true" type="INTEGER"/>
<column name="GROUP_ID" required="true" primaryKey="true" type="INTEGER"/>
<column name="ROLE_ID" required="true" primaryKey="true" type="INTEGER"/>
<foreign-key foreignTable="MYAPP_USER">
<reference local="USER_ID" foreign="USER_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_GROUP">
<reference local="GROUP_ID" foreign="GROUP_ID"/>
</foreign-key>
<foreign-key foreignTable="MYAPP_ROLE">
<reference local="ROLE_ID" foreign="ROLE_ID"/>
</foreign-key>
</table>
</database>
--- cut --- myapp-schema.xml ---
--- cut --- MyAppUser.java ---
package de.intermeta.myapp.security;
import org.apache.turbine.services.security.torque.TorqueUser;
import de.intermeta.myapp.security.om.MyappUser;
public class MyAppUser
extends TorqueUser
{
/**
* Constructor.
*/
public MyAppUser()
{
super();
}
/**
* This Constructor is used when the UserPeerManager
* has retrieved a list of Database Objects from the peer and
* must 'wrap' them into TorqueRole Objects. You should not use it directly!
*
* @param obj An Object from the peer
*/
public MyAppUser(Persistent obj)
{
super(obj);
}
public int getLanguageId()
{
return ((MyappUser) getPersistentObj()).getLanguageId();
}
public void setLanguageId(int languageId)
{
((MyappUser) getPersistentObj()).setLanguageId(languageId);
}
public int getGruppenId()
{
return ((MyappUser) getPersistentObj()).getGruppenId();
}
public void setGruppenId(int gruppenId)
{
((MyappUser) getPersistentObj()).setGruppenId(gruppenId);
}
}
--- cut --- MyAppUser.java ---
- Run the schema, you should get de.intermeta.myapp.security.om.<lots of classes>
- add de.intermeta.maxpatch.myapp.security.MyAppUser.java
- configure Turbine as described above
- create the tables with maven torque:sql, put them into a database (I use PostgreSQL).
Insert some data into the tables:
--- cut ---
INSERT INTO MYAPP_USER (USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
VALUES (1,'turbine','turbine','Mr.','Turbine');
INSERT INTO MYAPP_PERMISSION (PERMISSION_ID,PERMISSION_NAME)
VALUES (1,'Myapp');
INSERT INTO MYAPP_ROLE (ROLE_ID,ROLE_NAME)
VALUES (1,'MyappAdmin');
INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
VALUES (1,'global');
INSERT INTO MYAPP_GROUP (GROUP_ID,GROUP_NAME)
VALUES (2,'Myapp');
INSERT INTO TURBINE_ROLE_PERMISSION (ROLE_ID,PERMISSION_ID)
VALUES (1,1);
INSERT INTO TURBINE_USER_GROUP_ROLE (USER_ID,GROUP_ID,ROLE_ID)
VALUES (1,2,1);
--- cut ---
Now you should be able to log on with user "turbine" , pw "turbine".
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by Zamek <za...@vili.pmmf.hu>.
Hello,
On Wednesday 02 July 2003 10.50, Henning P. Schmiedehausen wrote:
> Zamek <za...@vili.pmmf.hu> writes:
>
> If you feel adventurous,
absolutely
> please look at
>
> http://jakarta.apache.org/turbine/turbine-2.3/services/torque-security-serv
>ice.html
I red it, and try to install based on it
> I'd love to get more exposure to this. It works fine in all my
> applications, but I really like to get more feedback.
I would like to get a working TR.props file or a part of TR.prop
for compensation, I will correct, and comment the documentation.
TIA
--
Zoltan Zidarics programmer
PTE University Pecs, Hungary
icq: 43288694
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org
Re: Extending user in T2.3
Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Zamek <za...@vili.pmmf.hu> writes:
If you feel adventurous, please look at
http://jakarta.apache.org/turbine/turbine-2.3/services/torque-security-service.html
I'd love to get more exposure to this. It works fine in all my
applications, but I really like to get more feedback.
Regards
Henning
>Hello All,
>I need extending TurbineUser in my T2.3 app. In TR.properties I set
>services.SecurityService.classname=org.apache.turbine.services.security.db.DBSecurityService
>services.SecurityService.user.manager
>=org.apache.turbine.services.security.db.DBUserManager
>services.SecurityService.user.class=com.zamek.ecdl.om.EcdlUser
>services.SecurityService.userPeer.class=com.zamek.ecdl.om.EcdlUserPeer
>where EcdlUser is
> extends com.zamek.ecdl.om.BaseEcdlUser implements Persistent, User
>and BaseEcdlUser is
> extends com.zamek.ecdl.om.TurbineUserAdapter
>and TurbineUserAdapter is
> extends org.apache.turbine.om.security.TurbineUser
>like Extending user howto.
>And when I try this:
> EcdlUser usr = (EcdlUser) data.getUser();
>I get an Exception:
>java.lang.ClassCastException: org.apache.turbine.om.security.TurbineUser
> at com.zamek.ecdl.modules.screens.Index.doBuildTemplate(Index.java:86)
>It seems to be Turbine doesn't use my TR.properties settings. It remains
> org.apache.turbine.om.security.TurbineUser.
>How can I extending user?
>I tried TorqueSecurityService as written in howto (config part at end of my
>letter) and I have this error too:
>java.lang.ClassCastException: org.apache.turbine.om.security.TurbineUser
>I downloaded the latest version of turbine and torque too, and I successfully
>compiled it with maven.
>My Torque security settings
>services.SecurityService.classname=org.apache.turbine.services.security.torque.TorqueSecurityService
>services.SecurityService.torque.userPeer.class =
>org.apache.turbine.services.security.torque.om.TurbineUserPeer
># The columns in the peer used to retrieve information. These are the names of
>the constants
># in the configured peer
>services.SecurityService.torque.userPeer.column.name = LOGIN_NAME
>services.SecurityService.torque.userPeer.column.id = USER_ID
>services.SecurityService.torque.userPeer.column.password = PASSWORD_VALUE
>services.SecurityService.torque.userPeer.column.firstname = FIRST_NAME
>services.SecurityService.torque.userPeer.column.lastname = LAST_NAME
>services.SecurityService.torque.userPeer.column.email = EMAIL
>services.SecurityService.torque.userPeer.column.confirm = CONFIRM_VALUE
>services.SecurityService.torque.userPeer.column.createdate = CREATED
>services.SecurityService.torque.userPeer.column.lastlogin = LAST_LOGIN
>services.SecurityService.torque.userPeer.column.objectdata = OBJECTDATA
>services.SecurityService.torque.user.class =
>org.apache.turbine.services.security.torque.om.TurbineUser
># These bean properties are queried from the returned object to retrieve the
># information
>services.SecurityService.torque.user.property.name = UserName
>services.SecurityService.torque.user.property.id = UserId
>services.SecurityService.torque.user.property.password = Password
>services.SecurityService.torque.user.property.firstname = FirstName
>services.SecurityService.torque.user.property.lastname = LastName
>services.SecurityService.torque.user.property.email = Email
>services.SecurityService.torque.user.property.confirm = Confirmed
>services.SecurityService.torque.user.property.createdate = CreateDate
>services.SecurityService.torque.user.property.lastlogin = LastLogin
>services.SecurityService.torque.user.property.objectdata = Objectdata
># This is the Peer class used to access the Group Peer
>(org.apache.turbine.services.security.torque.om.TurbineGroupPeer)
>services.SecurityService.torque.groupPeer.class =
>org.apache.turbine.services.security.torque.om.TurbineGroupPeer
># The columns in the peer used to retrieve information. These are the names of
>the constants
># in the configured peer
>services.SecurityService.torque.groupPeer.column.name = GROUP_NAME
>services.SecurityService.torque.groupPeer.column.id = GROUP_ID
># These are the objects returned by the configured group peer
>(org.apache.turbine.services.security.torque.om.TurbineGroup)
>services.SecurityService.torque.group.class =
>org.apache.turbine.services.security.torque.om.TurbineGroup
>services.SecurityService.torque.group.property.name = Name
>services.SecurityService.torque.group.property.id = GroupId
>services.SecurityService.torque.rolePeer.class =
>org.apache.turbine.services.security.torque.om.TurbineRolePeer
>services.SecurityService.torque.rolePeer.column.name = ROLE_NAME
>services.SecurityService.torque.rolePeer.column.id = ROLE_ID
>services.SecurityService.torque.role.class =
>org.apache.turbine.services.security.torque.om.TurbineRole
>services.SecurityService.torque.role.property.name = Name
>services.SecurityService.torque.role.property.id = RoleId
>services.SecurityService.torque.permissionPeer.class =
>org.apache.turbine.services.security.torque.om.TurbinePermissionPeer
>services.SecurityService.torque.permissionPeer.column.name = PERMISSION_NAME
>services.SecurityService.torque.permissionPeer.column.id = PERMISSION_ID
>services.SecurityService.torque.permission.class =
>org.apache.turbine.services.security.torque.om.TurbinePermission
>services.SecurityService.torque.permission.property.name = Name
>services.SecurityService.torque.permission.property.id = PermissionId
>TIA
>--
>udv,
>Zoltan Zidarics programmer
>PTE University Pecs, Hungary
>icq: 43288694
>---------------------------------------------------------------------
>To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: turbine-user-help@jakarta.apache.org
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
hps@intermeta.de +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org