Fields for editing per-user connection limits
This commit is contained in:
parent
529d278d61
commit
a322c6f585
@ -97,3 +97,5 @@ Added greater than / less than selectors to the table data search form.
|
||||
The SSL / X509 authentication type for a user can be set on the Edit User page.
|
||||
---- Changes since 1.560 ----
|
||||
Added confirmation before deleting multiple user, host, database, table and column permissions.
|
||||
---- Changes since 1.570 ----
|
||||
Added fields to the Edit User page for setting the maximum concurrent logins and operations per hour for users.
|
||||
|
@ -64,6 +64,18 @@ for($i=3; $i<=&user_priv_cols()+3-1; $i++) {
|
||||
print &ui_table_row($text{'user_perms'},
|
||||
&ui_select("perms", \@sel, \@opts, 10, 1, 1));
|
||||
|
||||
# Various per-user limits
|
||||
foreach $f ('max_user_connections', 'max_connections',
|
||||
'max_questions', 'max_updates') {
|
||||
if ($mysql_version >= 5 && $fieldmap{$f}) {
|
||||
print &ui_table_row($text{'user_'.$f},
|
||||
&ui_opt_textbox($f,
|
||||
$u->[$fieldmap{$f}] || undef,
|
||||
5, $text{'user_maxunlimited'},
|
||||
$text{'user_maxatmost'}));
|
||||
}
|
||||
}
|
||||
|
||||
# SSL needed?
|
||||
if ($mysql_version >= 5 && $fieldmap{'ssl_type'}) {
|
||||
print &ui_table_row($text{'user_ssl'},
|
||||
|
@ -313,6 +313,16 @@ user_ssl=Required certificate type
|
||||
user_ssl_=None
|
||||
user_ssl_any=SSL
|
||||
user_ssl_x509=X509
|
||||
user_max_user_connections=Maximum concurrent logins
|
||||
user_max_connections=Maximum connections per hour
|
||||
user_max_updates=Maximum updates per hour
|
||||
user_max_questions=Maximum queries per hour
|
||||
user_maxunlimited=Unlimited
|
||||
user_maxatmost=At most
|
||||
user_emax_user_connections=Maximum concurrent logins must be a number
|
||||
user_emax_connections=Maximum connections per hour must be a number
|
||||
user_emax_updates=Maximum updates per hour must be a number
|
||||
user_emax_questions=Maximum queries per hour must be a number
|
||||
|
||||
dbs_title=Database Permissions
|
||||
dbs_db=Databases
|
||||
|
@ -49,20 +49,35 @@ else {
|
||||
if ($in{'mysqlpass_mode'} == 0) {
|
||||
$esc = &escapestr($in{'mysqlpass'});
|
||||
&execute_sql_logged($master_db,
|
||||
"update user set password = $password_func('$esc') ".
|
||||
"where user = '$user' and host = '$host'");
|
||||
"update user set password = $password_func('$esc') ".
|
||||
"where user = ? and host = ?",
|
||||
$user, $host);
|
||||
}
|
||||
elsif ($in{'mysqlpass_mode'} == 2) {
|
||||
&execute_sql_logged($master_db,
|
||||
"update user set password = NULL ".
|
||||
"where user = '$user' and host = '$host'");
|
||||
"where user = ? and host = ?",
|
||||
$user, $host);
|
||||
}
|
||||
|
||||
# Save various limits
|
||||
foreach $f ('max_user_connections', 'max_connections',
|
||||
'max_questions', 'max_updates') {
|
||||
next if ($mysql_version < 5 || !defined($in{$f.'_def'}));
|
||||
$in{$f.'_def'} || $in{$f} =~ /^\d+$/ ||
|
||||
&error($text{'user_e'.$f});
|
||||
&execute_sql_logged($master_db,
|
||||
"update user set $f = ? ".
|
||||
"where user = ? and host = ?",
|
||||
$in{$f.'_def'} ? 0 : $in{$f}, $user, $host);
|
||||
}
|
||||
|
||||
# Set SSL fields
|
||||
if ($mysql_version >= 5 && defined($in{'ssl_type'})) {
|
||||
&execute_sql_logged($master_db,
|
||||
"update user set ssl_type = '$in{'ssl_type'}' ".
|
||||
"where user = '$user' and host = '$host'");
|
||||
"update user set ssl_type = ? ".
|
||||
"where user = ? and host = ?",
|
||||
$in{'ssl_type'}, $user, $host);
|
||||
}
|
||||
}
|
||||
&execute_sql_logged($master_db, 'flush privileges');
|
||||
|
Loading…
x
Reference in New Issue
Block a user