How to share schemas but varying table privileges (user/password)?

[prev] [thread] [next] [Date index for 2005/02/20]

From: Thomas L. Shinnick
Subject: How to share schemas but varying table privileges (user/password)?
Date: 21:45 on 20 Feb 2005
I've reviewed docs and maillist posts and seen several discussions of reusing classes/schemas across more than one database simultaneously.  My situation somewhat parallels those, though I'm hoping for a simpler answer or at least a "it won't hurt _that_ much."

I want to reuse the same classes, across different programs, but varying the DB/table privileges available via those classes.  This means that the user/password information for DBI connections would have to change from one program to the next, in order to vary the access privileges available to each program.  I see discussions of moving dbMain() higher in class hierarchies or playing with set_db() but they look rather painful.

Let me describe an example situation: three programs accessing a table of log information.  One program merely reads entries and generates reports.  One program tails a file and creates entries.  Another admin program requires full privileges such as deleting old records.  The desire is to allow each program only the least privileges it needs to run.

Each program could use the same CDBI-derived class for the table, however the usual scheme has the MyLogBase super class establishing the single user/password pair used to access the table.

Do I have to override dbMain() to force program-specific privileges?

Could I setup the usual DB-class -> table-class derivation, using the lowest priviledged user/password in the DB-class, and then do a set_db() later to get higher privileges?  How sensitive is set_db() timing?

How would using Class::DBI::Loader affect this, as program-specific config info might not yet be available when CDBI::Loader needed to make connections?

Any suggested strategies will be welcomed,
Tom


        -- 
        Sulzer's chairman said at a press conference that "We will drag them 
through the courts if needed."  Separately, Sulzer has a new name,
Centerpulse, and a new slogan, "Implanting trust."


How to share schemas but varying table privileges (user/password)?
Thomas L. Shinnick 21:45 on 20 Feb 2005

Generated at 16:36 on 28 Jul 2005 by mariachi v0.52