Skip to content

Commit d2510ed

Browse files
committed
Configurable permission for web directory, #6804
octdec() is needed to preserve the octal value.
1 parent c910fa2 commit d2510ed

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

install/tpl/server.ini.master

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ add_web_users_to_sshusers_group=y
121121
connect_userid_to_webid=n
122122
connect_userid_to_webid_start=10000
123123
web_folder_protection=y
124+
web_folder_permission=0710
124125
php_ini_check_minutes=1
125126
overtraffic_disable_web=y
126127
overquota_notify_threshold=90

interface/web/admin/form/server_config.tform.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,12 @@
10741074
'default' => 'n',
10751075
'value' => array(0 => 'n', 1 => 'y')
10761076
),
1077+
'web_folder_permission' => array(
1078+
'datatype' => 'VARCHAR',
1079+
'formtype' => 'TEXT',
1080+
'default' => '0710',
1081+
'maxlength' => '4'
1082+
),
10771083
'web_folder_protection' => array(
10781084
'datatype' => 'VARCHAR',
10791085
'formtype' => 'CHECKBOX',

interface/web/admin/lib/lang/en_server_config.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ $wb['firewall_txt'] = 'Firewall';
208208
$wb['mailbox_quota_stats_txt'] = 'Mailbox quota statistics';
209209
$wb['enable_ip_wildcard_txt'] = 'Enable IP wildcard (*)';
210210
$wb['web_folder_protection_txt'] = 'Make web folders immutable (extended attributes)';
211+
$wb['web_folder_permission_txt'] = 'Default permission for the web folder';
211212
$wb['overtraffic_notify_admin_txt'] = 'Send overtraffic notification to admin';
212213
$wb['overtraffic_notify_reseller_txt'] = 'Send overtraffic notification to reseller';
213214
$wb['overtraffic_notify_client_txt'] = 'Send overtraffic notification to client';

interface/web/admin/templates/server_config_web_edit.htm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,13 @@ <h4 class="panel-title">
263263
<div id="collapsePerms" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingPerms">
264264
<div class="panel-body">
265265
<!-- Begin content -->
266-
<div class="form-group">
266+
<div class="form-group">
267+
<label class="col-sm-3 control-label">{tmpl_var name=web_folder_permission_txt'}</label>
268+
<div class="col-sm-9">
269+
<input type="text" name="web_folder_permission" id="web_folder_permission" value="{tmpl_var name='web_folder_permission'}" class="form-control" />
270+
</div>
271+
</div>
272+
<div class="form-group">
267273
<label class="col-sm-3 control-label">{tmpl_var name='set_folder_permissions_on_update_txt'}</label>
268274
<div class="col-sm-9">
269275
{tmpl_var name='set_folder_permissions_on_update'}

server/plugins-available/apache2_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ function update($event_name, $data) {
10261026
if($web_config['security_level'] == 20) {
10271027

10281028
$app->system->chmod($data['new']['document_root'], 0755);
1029-
$app->system->chmod($data['new']['document_root'].'/web', 0711);
1029+
$app->system->chmod($data['new']['document_root'].'/web', octdec($web_config['web_folder_permission']));
10301030
$app->system->chmod($data['new']['document_root'].'/webdav', 0710);
10311031
$app->system->chmod($data['new']['document_root'].'/private', 0710);
10321032
$app->system->chmod($data['new']['document_root'].'/ssl', 0755);

server/plugins-available/nginx_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ function update($event_name, $data) {
878878
if($web_config['security_level'] == 20) {
879879

880880
$app->system->chmod($data['new']['document_root'], 0755);
881-
$app->system->chmod($data['new']['document_root'].'/web', 0751);
881+
$app->system->chmod($data['new']['document_root'].'/web', octdec($web_config['web_folder_permission']));
882882
//$app->system->chmod($data['new']['document_root'].'/webdav',0710);
883883
$app->system->chmod($data['new']['document_root'].'/private', 0710);
884884
$app->system->chmod($data['new']['document_root'].'/ssl', 0755);

0 commit comments

Comments
 (0)