Re: login dependend databases

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Apr 26 2005 - 08:15:57 EDT

  • Next message: Andrus Adamchik: "Re: login dependend databases"

    Actually DataDomains are intended for partitioning data access. Just make
    sure you assign a user session DataContext created for appropriate domain.
    This works if the total number of access groups is small.

    E.g. you can define the following domains in the Modeler: "login"
    (shared), "group1", "group2", etc.

    Then you may implement the following session flow:

    1. Create "login" DataContext based on a shared "login" domain:

      DataContext loginCtxt = DataContext.createDataContext("login");

    2. Autenticate user, determine her group.

    3. Create permanent session DataContext based on the group:

      String group = ...
      DataContext sessionCtxt = DataContext.createDataContext(group);

    I think Michael Gentry had a more detailed example somewhere.

    Andrus

    > Hello Juergen,
    >
    > we've solved this for us using:
    >
    > FileConfiguration lvCayenneFileConfig = new FileConfiguration
    > (lvCayenneConfigFile); lvCayenneFileConfig.addFilesystemPath
    > (lvCayenneConfigDirectory);
    > //System.out.println("--------------------------------->" +
    > lvCayenneFileConfig.getProjectFile().getAbsolutePath());
    > Configuration.initializeSharedConfiguration (lvCayenneFileConfig);
    >
    > where lvCayenneFileConfig points to the Directory and Filename where
    > Cayenne reads the cayennexyz.xml. We've appended the Portalname of the
    > Portal the user has been loged in. So there is a cayenne_info.xml and a
    > cayenne_edi.xml ... and so on.
    >
    > Hope this helps.
    >
    > Regards
    >
    > Dirk
    >
    > Jürgen Saar schrieb:
    >> Hi,
    >>
    >> I think the topic had been discussed in past, but I can't find the
    >> thread.
    >>
    >> I've got the follwing problem:
    >>
    >> We are developing a kind of info system,
    >> where our customers can give access to order informations via web.
    >>
    >> The problem is, that the orders are not all in one database,
    >> the choice of the database depends on the login ...
    >>
    >> I have no idea how to realize that with cayenne,
    >> even if I overide the classes that deal with the datanodes,
    >> how can I ensure that cayenne uses the right connection
    >> from the pool for the query of the actual login?
    >>
    >> Thanx
    >> --- Juergen ---
    >>
    >>
    >>
    >
    > --
    > Viele Grüße
    >
    > Dirk Wellmann
    > ----------------------------
    > PD Software GmbH
    > Amalung Straße 16
    > 37688 Beverungen
    >
    > fon.: +49 5275 98 78 0
    > fax.: +49 5275 98 78 18
    > mail: d..dsoft.de
    > www: www.pdsoft.de
    > --
    > Donald E. Knuth: There are better ways to earn a living than to prevent
    > other people from making use of one's contributions to computer
    > science.



    This archive was generated by hypermail 2.0.0 : Tue Apr 26 2005 - 08:16:00 EDT