📄 list_users.cgi
字号:
#!/usr/local/bin/perl# list_users.cgi# Lists all the users with quotas on some filesystemrequire './quota-lib.pl';$f = $ARGV[0];$whatfailed = "Failed to list users";&can_edit_filesys($f) || &error("You are not allowed to edit quotas on this filesystem");# List quotas&header("Filesystem Quotas", "", "list_users");print "<hr>\n";$n = &filesystem_users($f);if ($n > $config{'display_max'}) { print "<b>Too many users have quotas on <tt>$f</tt> ", "to display on one page</b><br>\n"; }elsif ($n) { print "<h3>All User Quotas on <tt>$f</tt></h3>\n"; print "<table border width=100%>\n"; print "<tr $tb> <td><br></td>\n"; @fs = &free_space($f); print "<td colspan=3 align=center><b>Blocks</b>\n"; print " ($fs[0] total / $fs[1] free)\n" if ($access{'diskspace'}); print "</td> <td colspan=3 align=center><b>Files</b>\n"; print " ($fs[2] total / $fs[3] free)\n" if ($access{'diskspace'}); print "</td> </tr>\n"; print "<tr $tb> <td><b>User</b></td>\n"; print "<td><b>Used</b></td> <td><b>Soft Limit</b></td>\n"; print "<td><b>Hard Limit</b></td> <td><b>Used</b></td>\n"; print "<td><b>Soft Limit</b></td> <td><b>Hard Limit</b></td> </tr>\n"; @order = (0 .. $n-1); @order = sort { $user{$b,'ublocks'} <=> $user{$a,'ublocks'} } @order; foreach $i (@order) { next if (!&can_edit_user($user{$i,'user'})); print "<tr $cb>\n"; print "<td><a href=\"edit_user_quota.cgi?user=$user{$i,'user'}", "&filesys=$f&source=0\">$user{$i,'user'}</a></td>\n"; print "<td>$user{$i,'ublocks'}</td>\n"; &print_limit($user{$i,'sblocks'}); &print_limit($user{$i,'hblocks'}); print "<td>$user{$i,'ufiles'}</td>\n"; &print_limit($user{$i,'sfiles'}); &print_limit($user{$i,'hfiles'}); print "</tr>\n"; } print "</table><br>\n"; }else { print "<b>No users have quotas on <tt>$f</tt></b><br>\n"; }print "<table width=100%><tr>\n";print "<form action=edit_user_quota.cgi>\n";print "<input type=hidden name=filesys value=\"$f\">\n";print "<input type=hidden name=source value=0>\n";print "<td align=left width=33%>\n";print "<input type=submit value=\"Edit Quota For:\">\n";print "<input name=user size=8> ", &user_chooser_button("user", 0),"</td></form>\n";if ($access{'ugrace'}) { print "<form action=user_grace_form.cgi>\n"; print "<input type=hidden name=filesys value=\"$f\">\n"; print "<td align=center width=33%>\n"; print "<input type=submit value=\"Edit Grace Times\">\n"; print "</td></form>\n"; }else { print "<td width=33%></td>\n"; }print "<form action=check_quotas.cgi>\n";print "<input type=hidden name=filesys value=\"$f\">\n";print "<input type=hidden name=source value=user>\n";print "<td align=right width=33%><input type=submit value=\"Check Quotas\">\n";print "</td></form> </tr></table>\n";if ($access{'default'}) { print "<hr>\n"; print "Webmin can be configured to automatically set the quotas\n"; print "on this filesystem when a new Unix user is created.\n"; print "This will only work when the <tt>Users, Groups and\n"; print "Passwords</tt> Webmin module is used to add users. <p>\n"; @dquot = split(/\s+/, $config{"sync_$f"}); print "<form action=save_sync.cgi>\n"; print "<input type=hidden name=filesys value=\"$f\">\n"; print "<table width=100% border> <tr $tb>\n"; print "<td colspan=2><b>New User Quotas</b></td> </tr> <tr $cb>\n"; print "<td width=50%><table><tr>\n"; print "<td><b>Soft Block Limit</b></td> <td>\n"; "a_input("sblocks", $dquot[0]); print "</td> </tr><tr> <td><b>Hard Block Limit</b></td> <td>\n"; "a_input("hblocks", $dquot[1]); print "</td> </tr></table></td>\n"; print "<td width=50%><table><tr>\n"; print "<td><b>Soft File Limit</b></td> <td>\n"; "a_input("sfiles", $dquot[2]); print "</td> </tr><tr> <td><b>Hard File Limit</b></td> <td>\n"; "a_input("hfiles", $dquot[3]); print "</td> </tr></table></td>\n"; print "</tr> </table><p>\n"; print "<input type=submit value=Apply></form>\n"; }print "<hr>\n";&footer("", "filesystems list");sub print_limit{if ($_[0] == 0) { print "<td>Unlimited</td>\n"; }else { print "<td>$_[0]</td>\n"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -