Module config option for permissions, UI cleanup

This commit is contained in:
Jamie Cameron
2009-01-28 00:22:34 +00:00
parent c26296e5e0
commit 03a3c1a3a9
4 changed files with 15 additions and 5 deletions
+2
View File
@@ -20,3 +20,5 @@ Users can be limited to only editing users and groups (and not adding or changin
Converted all user interface code to use the new Webmin UI library, for consistency.
Fixed a bug that prevented a groups file from being added to an existing directory.
Added a button to link to the Apache module (if accessible) for editing all settings in the .htaccess file.
---- Changes since 1.450 ----
Added a Module Config option to set permissions on created .htaccess and .htpasswd files, which defaults to 644.
+1
View File
@@ -6,3 +6,4 @@ md5=Offer MD5 encryption option?,1,1-Yes,0-No
sha1=Offer SHA1 encryption option?,1,1-Yes,0-No
digest=Offer digest encryption option?,1,1-Yes,0-No
extra_directives=Extra directives to include in .htaccess,9,0,0,\t
perms=Permissions for created files,3,Default (644)
+2 -4
View File
@@ -18,8 +18,7 @@ else {
print &ui_form_start("save_dir.cgi");
print &ui_hidden("new", $in{'new'});
print &ui_hidden_table_start($text{'dir_header'}, undef, 2, "main", 1,
[ "width=30%" ]);
print &ui_hidden_table_start($text{'dir_header'}, "width=100%", 2, "main", 1, [ "width=30%" ]);
# Directory to protect
if ($in{'new'}) {
@@ -114,8 +113,7 @@ print &ui_hidden_table_end();
# Webmin synchronization mode
if ($can_sync) {
print &ui_hidden_table_start($text{'dir_header2'}, undef, 2, "sync", 0,
[ "width=30%" ]);
print &ui_hidden_table_start($text{'dir_header2'}, "width=100%", 2, "sync", 0, [ "width=30%" ]);
%sync = map { $_, 1 } split(/,/, $dir->[3]);
foreach $s ('create', 'update', 'delete') {
+10 -1
View File
@@ -46,11 +46,16 @@ $currgfile = &foreign_call($apachemod, "find_directive",
$agf, $conf, 1);
&lock_file($currfile) if ($currfile);
# Make sure it is allowed
# Make sure it is allowed, and create new file if needed
&switch_user();
&can_access_dir($htaccess) || &error($text{'dir_ecannot'});
$missing = !-r $htaccess;
&open_tempfile(TEST, ">>$htaccess", 1) || &error(&text('dir_ehtaccess', $htaccess, $!));
&close_tempfile(TEST);
if ($missing) {
&set_ownership_permissions(
undef, undef, oct($config{'perms'}) || 0644, $htaccess);
}
if ($in{'delete'} || $in{'remove'}) {
if ($in{'remove'}) {
@@ -250,6 +255,8 @@ else {
&close_tempfile(FILE) ||
&error(&text('dir_ehtpasswd', $file, $!));
&unlock_file($file);
&set_ownership_permissions(
undef, undef, oct($config{'perms'}) || 0644, $file);
}
# Create an empty groups file if needed
@@ -260,6 +267,8 @@ else {
&close_tempfile(FILE) ||
&error(&text('dir_ehtgroup', $gfile, $!));
&unlock_file($gfile);
&set_ownership_permissions(
undef, undef, oct($config{'perms'}) || 0644, $gfile);
}
}