Hi,

Alternately, you can specify the users/roles/groups in your
turbine-security.xml conf file.  For example,

<TurbineUser UserId="1" LoginName="admin" PasswordValue="guessme"
FirstName="ad" LastName="min"/>
<TurbineGroup GroupId="1" GroupName="global"/>
<TurbinePermission PermissionId="1" PermissionName="user_admin"/>
<TurbineRole RoleId="1" RoleName="admin"/>
<TurbineRolePermission RoleId="1" PermissionId="1"/>
<TurbineUserGroupRole UserId="1" GroupId="1" RoleId="1"/>

Then, after a little monkeying around with the build.xml and
build-torque.xml files, you can import this into the database:

build.xml:

  <target
    name="security">
    <antcall target="schema-sql"/>
    <antcall target="security-sql"/>
    <ant
      antfile="${torque.buildFile}"
      target="insert-security-sql">
    </ant>
  </target>
  

build-torque.xml:

  <target
    name="insert-security-sql"
    description="==> inserts the generated sql ">

    <sql
      autocommit="true"
      driver="${torque.database.driver}"
      onerror="continue"
      password="${torque.database.password}"
      src="${torque.sql.dir}/turbine-schema.sql"
      url="${torque.database.buildUrl}"
      userid="${torque.database.user}">
      <classpath refid="torque-classpath"/>
    </sql>
    <sql
      autocommit="true"
      driver="${torque.database.driver}"
      onerror="continue"
      password="${torque.database.password}"
      src="${torque.sql.dir}/turbine-security.sql"
      url="${torque.database.buildUrl}"
      userid="${torque.database.user}">
      <classpath refid="torque-classpath"/>
    </sql>
  </target>

Then just run 'ant security' and it will refresh all your
users/groups/roles/etc.  But be careful since written like this, it will
blow away all the security that isn't in your xml file, so it probably most
useful in dev.  You can remove the first <sql> from the build-torque.xml
file and be prepared for a bunch of primary key errors if you just want to
add to your current users/groups/roles.

My reply turned out to be a lot longer than I expected.  And it doesn't
really answer your question since you wanted something you could run from
your application.  But the reply was so long, I didn't want to waste it so
I'm sending it anyway.

Good luck,

David

-----Original Message-----
From: Chris Joelly [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 14, 2004 8:38 AM
To: [EMAIL PROTECTED]
Subject: inserting user into mysql for use with turbine security


Hello!

i want to insert/update an user from within my application for use with
turbine security. i looked at the datamodel and have inserted the user
with the following statements into TURBINE_USER and TURBINE_USER_GROUP_ROLE


insert into TURBINE_USER (USER_ID, LOGIN_NAME, PASSWORD_VALUE, FIRST_NAME,
LAST_NAME)
        values (1001, 'portal', 'portal', 'APortal', 'User');
        
insert into TURBINE_USER_GROUP_ROLE (USER_ID, GROUP_ID, ROLE_ID)
        values (1001, 1, 2);

are there any other tables to set? the group and role used in this
example does exist, but i can't login with this user ...

thx, Chris

-- 
mit freundlichen Gr��en / with kind regards
 
Ing. Christian J�lly @ Solutions
unycom  Information Technology Services GmbH
A-8042 Graz | Schmiedlstra�e 1 / III

Tel: ++43 (0)316 / 818 828 - 30
Fax: ++43 (0)316 / 818 828 - 38
[EMAIL PROTECTED]
http://www.unycom.com

Christel zu Oli (es ging um /etc/apt/sources.list):

"Unstable?!  Bist Du bescheuert?"

---------------------------------------------------------------------
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]

Reply via email to