Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to expand single user WebApp to multiple users
    text
    copied!<p>There are a similar threads without a concrete solution and I thought it was better to start a new one. </p> <p>I am facing a situation where I have a WebApp hosted in RESIN (just like Tomcat I guess). So far I have been developing the app using db4o since I'm alone and I needed to complete the app ASAP, I have a DB for users and another DB for app data for a single user (me), now that the app is almost done I'm about to move to postgresql and I am thinking seriously about a DB per user even if the DB holds data for multiple apps since it will handle kinda confidential data and I thought having separate DB will be the best (security wise). There is already a rudimentary session management that stores user data like an ID in the browser. But I was wondering how can I expand it to multiple users/db. </p> <p>I was thinking to expand the listener class that keeps the context data to pass the right db object to the app instance, or maybe set a filter for that purpose. </p> <p>.UPDATE.</p> <p>I wanted to give some more insight of what I currently have.</p> <p>I have:</p> <p>Context that holds a reference to some objects, one of those objects connects to a DB and checks for the user and password.</p> <p>Presentation servlet (HttpServlet) mapped to "/" that has the login form that POST to /login.</p> <p>Login servlet (HttpServlet) mapped to "/login" that checks the httpSession user password attributes against the respective object that rests in the Context, if there is a match sets an httpSession attribute that holds the USERID and redirects the user to the app itself located at /index-debug.html if not it creates a new html page with a login form again.</p> <p>Authorization and authentication filters mapped to /index-debug.html that verifies the httpServletRequest for the USERID attribute and checks whether or not the user has permission to access the app.</p> <p>Finally a DB bean that is in charge of reading and writing to the webApp user data DB. When I execute certain method in the webApp CP2JAVAWS matches that method to the respective method in the bean, the problem is that this bean has a static database and so far it only allows one user at the time.</p> <p>What I would like to do is somehow allow this DB bean to instantiate once per user and read and store the corresponding data depending of the current logged user.</p> <p>The idea of one DB per user is currently discarded but I don't know how exactly pull that off.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload