On 31/Oct/2008 04:04 Grant Peel wrote ..
All,
 
I have a custom Webmin mondule written that add a new musql database, sets the mysql permissions etc and it works well, except that it does not add the Usermin permissions correctly.
 
Here is the code:
 
&read_file("$config{'usermin_mysql_dir'}/config", \%mconfig);
$mconfig{'access'} .= "\t$in{'user'}: $db";
&write_file("$config{'usermin_mysql_dir'}/config", \%mconfig);
 
When I look in Usermin Configuration -> Usermin Module Configuration -> MySQL Database, the "Database Access control list is getting completely new entries put in them, when it should be appended.
 
Current:
 
user: database1 database2
 
But what I am getting is:
 
user: database1
user: database2
 
Can the above perl/regex be adjust to do it correctly?

Yes .. you should use code like :

if ($mconfig{'access'} =~ /$in{'user'}:/) {
 
$mconfig{'access'} =~ s/$in{'user'}:/$in{'user'}: $db/;
  }
else {
  $mconfig{'access'} .= "\t$in{'user'}: $db";
}

 - Jamie