#910 File-based User specific configuration

fixed
nobody
None
5
2013-06-11
2006-04-04
paulpgm
No

In my environment, I have several different
programmer/dba that need to access different
databases. With a minor change to common.lib.php I
have been able to implement that by giving each user
their own configuration file which provides access to
the specific databases they need.

It gets the logged in username from the server,
removes the domain in the case of Windows, and checks
for a user specific configuration file.

/**
* Detects the config file we want to load
*/
$config_to_load = "./config.inc.php";
$username = @$_SERVER["PHP_AUTH_USER"];
$arr = explode("\\",$username);
$username = end($arr);
if ($username != "") {
if (file_exists('./config_' .
$username . '.inc.php')) {
$config_to_load = './config_' .
$username . '.inc.php';
}
}
$_SESSION['PMA_Config'] = new PMA_Config
($config_to_load);
// $_SESSION['PMA_Config'] = new PMA_Config
('./config.inc.php');

I have made this change to a couple of different
versions and think it may be helpful to others. It
would also eliminate my need to customize with each
update.

Thanks

Discussion

  • Marc Delisle
    Marc Delisle
    2006-04-11

    • summary: User specific configuration --> File-based User specific configuration
     
  • Michal Čihař
    Michal Čihař
    2006-11-02

    Logged In: YES
    user_id=192186

    Wouldn't be better to give them proper MySQL privileges?

     
  • paulpgm
    paulpgm
    2007-12-19

    Logged In: YES
    user_id=1493762
    Originator: YES

    My configuration files include the database username and password. I need the separate configuration files to supply different login information before that level of security may be enforced. I am using the config auth_type.

     
  • Michal Čihař
    Michal Čihař
    2010-09-16

    For general user configuration, there is option to store settings in database or browser local storage.

    For login information, I'd suggest you rather use signon auth type, it seems to be something you need.

     
  • Michal Čihař
    Michal Čihař
    2010-09-16

    • status: open --> pending
     
    • status: pending --> closed
     
  • This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • Michal Čihař
    Michal Čihař
    2013-06-11

    • Status: closed --> fixed