Keith Seim <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
>> Sent: 02 July 2003 14:16
>> To: [EMAIL PROTECTED]
>> Subject: Re: Extending user in T2.3
>>
>>
>> Zamek <[EMAIL PROTECTED]> 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
>> [EMAIL PROTECTED] +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: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>___________________________________
>Keith Seim =95 http://kjsdesigns.com
>--Apple-Mail-4--525461840--
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
[EMAIL PROTECTED] +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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]