3 Replies Latest reply on Jul 6, 2009 11:40 AM by nschweig

    DatabaseLoginServerModule - query with id possible?

    nschweig

      Hi,

      I have got an application with databaseserverloginmodule.
      The rolesQuery I tested with a simple example had the following queries:

      <module-option name="principalsQuery">
       select password from cmtuser where username=?</module-option>
       <module-option name="rolesQuery">
       select userroles, 'Roles' from userroles where username=?</module-option>
      


      I created the database in a way that the queries could work.
      (table roles : int id, rolename varchar)
      (table users: int id, username varchar, passwd varchar)
      (table userroles: int id, userroles varchar, username varchar)

      Now I have got another application where the jointable user/roles (cmtuser_role) contains the ids from the user and the roles and not the names.
      table cmtuser_role (int id, cmtuser_id int, roles_id int)

      and I have got the problem that the queries I used in the other application are not working.

      The rolesQuery now should be sth. like
      select userroles, 'Roles' from userroles where userid=?


      but I think "where user_id=" can not work. Is there a possibility to write a subquery in the roles query string to get the id or sth.?

      Or do I have to write a custom login module?

      Thanks for your hints.
      NSchweig