Skip to content

Commit 5240770

Browse files
committed
Implemented: FS#899 - Folder protection
1 parent fbb24ac commit 5240770

24 files changed

+1154
-14
lines changed

install/sql/ispconfig3.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,7 @@ CREATE TABLE IF NOT EXISTS `web_folder_user` (
15571557
`sys_perm_user` varchar(5) DEFAULT NULL,
15581558
`sys_perm_group` varchar(5) DEFAULT NULL,
15591559
`sys_perm_other` varchar(5) DEFAULT NULL,
1560+
`server_id` int(11) NOT NULL DEFAULT '0',
15601561
`web_folder_id` int(11) NOT NULL DEFAULT '0',
15611562
`username` varchar(255) DEFAULT NULL,
15621563
`password` varchar(255) DEFAULT NULL,
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<h2><tmpl_var name="list_head_txt"></h2>
2+
<p><tmpl_var name="list_desc_txt"></p>
3+
4+
<div class="panel panel_server_config">
5+
6+
<div class="pnl_formsarea">
7+
<fieldset class="inlineLabels"><legend>UFW Firewall</legend>
8+
<div class="ctrlHolder">
9+
<p class="label">{tmpl_var name='ufw_enable_txt'}</p>
10+
<div class="multiField">
11+
{tmpl_var name='ufw_enable'}
12+
</div>
13+
</div>
14+
<div class="ctrlHolder">
15+
<p class="label">{tmpl_var name='ufw_manage_builtins_txt'}</p>
16+
<div class="multiField">
17+
{tmpl_var name='ufw_manage_builtins'}
18+
</div>
19+
</div>
20+
<div class="ctrlHolder">
21+
<p class="label">{tmpl_var name='ufw_ipv6_txt'}</p>
22+
<div class="multiField">
23+
{tmpl_var name='ufw_ipv6'}
24+
</div>
25+
</div>
26+
<div class="ctrlHolder">
27+
<label for="ufw_default_input_policy">{tmpl_var name='ufw_default_input_policy_txt'}</label>
28+
<select name="ufw_default_input_policy" id="ufw_default_input_policy" class="selectInput">
29+
{tmpl_var name='ufw_default_input_policy'}
30+
</select>
31+
</div>
32+
<div class="ctrlHolder">
33+
<label for="ufw_default_output_policy">{tmpl_var name='ufw_default_output_policy_txt'}</label>
34+
<select name="ufw_default_output_policy" id="ufw_default_output_policy" class="selectInput">
35+
{tmpl_var name='ufw_default_output_policy'}
36+
</select>
37+
</div>
38+
<div class="ctrlHolder">
39+
<label for="ufw_default_forward_policy">{tmpl_var name='ufw_default_forward_policy_txt'}</label>
40+
<select name="ufw_default_forward_policy" id="ufw_default_forward_policy" class="selectInput">
41+
{tmpl_var name='ufw_default_forward_policy'}
42+
</select>
43+
</div>
44+
<div class="ctrlHolder">
45+
<label for="ufw_default_application_policy">{tmpl_var name='ufw_default_application_policy_txt'}</label>
46+
<select name="ufw_default_application_policy" id="ufw_default_application_policy" class="selectInput">
47+
{tmpl_var name='ufw_default_application_policy'}
48+
</select>
49+
</div>
50+
<div class="ctrlHolder">
51+
<label for="ufw_log_level">{tmpl_var name='ufw_log_level_txt'}</label>
52+
<select name="ufw_log_level" id="ufw_log_level" class="selectInput">
53+
{tmpl_var name='ufw_log_level'}
54+
</select>
55+
</div>
56+
</fieldset>
57+
58+
<input type="hidden" name="id" value="{tmpl_var name='id'}">
59+
60+
<div class="buttonHolder buttons">
61+
<button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','admin/server_config_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
62+
<button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('admin/server_config_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
63+
</div>
64+
</div>
65+
66+
</div>

interface/web/client/client_del.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function onAfterDelete() {
131131
$app->db->query("DELETE FROM sys_user WHERE client_id = $client_id");
132132

133133
// Delete all records (sub-clients, mail, web, etc....) of this client.
134-
$tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_domain,web_traffic';
134+
$tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_domain,web_traffic,web_folder,web_folder_user';
135135
$tables_array = explode(',',$tables);
136136
$client_group_id = intval($client_group['groupid']);
137137
if($client_group_id > 1) {
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?php
2+
3+
/*
4+
Form Definition
5+
6+
Tabledefinition
7+
8+
Datatypes:
9+
- INTEGER (Forces the input to Int)
10+
- DOUBLE
11+
- CURRENCY (Formats the values to currency notation)
12+
- VARCHAR (no format check, maxlength: 255)
13+
- TEXT (no format check)
14+
- DATE (Dateformat, automatic conversion to timestamps)
15+
16+
Formtype:
17+
- TEXT (Textfield)
18+
- TEXTAREA (Textarea)
19+
- PASSWORD (Password textfield, input is not shown when edited)
20+
- SELECT (Select option field)
21+
- RADIO
22+
- CHECKBOX
23+
- CHECKBOXARRAY
24+
- FILE
25+
26+
VALUE:
27+
- Wert oder Array
28+
29+
Hint:
30+
The ID field of the database table is not part of the datafield definition.
31+
The ID field must be always auto incement (int or bigint).
32+
33+
34+
*/
35+
36+
$form["title"] = "Web Folder";
37+
$form["description"] = "";
38+
$form["name"] = "web_folder";
39+
$form["action"] = "web_folder_edit.php";
40+
$form["db_table"] = "web_folder";
41+
$form["db_table_idx"] = "web_folder_id";
42+
$form["db_history"] = "yes";
43+
$form["tab_default"] = "folder";
44+
$form["list_default"] = "web_folder_list.php";
45+
$form["auth"] = 'yes'; // yes / no
46+
47+
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
48+
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
49+
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
50+
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
51+
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
52+
53+
$form["tabs"]['folder'] = array (
54+
'title' => "Folder",
55+
'width' => 100,
56+
'template' => "templates/web_folder_edit.htm",
57+
'fields' => array (
58+
##################################
59+
# Begin Datatable fields
60+
##################################
61+
'server_id' => array (
62+
'datatype' => 'INTEGER',
63+
'formtype' => 'SELECT',
64+
'default' => '',
65+
'datasource' => array ( 'type' => 'SQL',
66+
'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
67+
'keyfield'=> 'server_id',
68+
'valuefield'=> 'server_name'
69+
),
70+
'value' => ''
71+
),
72+
'parent_domain_id' => array (
73+
'datatype' => 'INTEGER',
74+
'formtype' => 'SELECT',
75+
'default' => '',
76+
'datasource' => array ( 'type' => 'SQL',
77+
'querystring' => "SELECT domain_id,domain FROM web_domain WHERE type = 'vhost' AND {AUTHSQL} ORDER BY domain",
78+
'keyfield'=> 'domain_id',
79+
'valuefield'=> 'domain'
80+
),
81+
'value' => ''
82+
),
83+
'path' => array (
84+
'datatype' => 'VARCHAR',
85+
'formtype' => 'TEXT',
86+
'validators' => array ( 0 => array ( 'type' => 'REGEX',
87+
'regex' => '/^[\w\.\-\_\/]{0,255}$/',
88+
'errmsg'=> 'path_error_regex'),
89+
),
90+
'default' => '/',
91+
'value' => '',
92+
'width' => '30',
93+
'maxlength' => '255'
94+
),
95+
'active' => array (
96+
'datatype' => 'VARCHAR',
97+
'formtype' => 'CHECKBOX',
98+
'default' => 'y',
99+
'value' => array(0 => 'n',1 => 'y')
100+
),
101+
##################################
102+
# ENDE Datatable fields
103+
##################################
104+
)
105+
);
106+
107+
108+
109+
110+
?>
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?php
2+
3+
/*
4+
Form Definition
5+
6+
Tabledefinition
7+
8+
Datatypes:
9+
- INTEGER (Forces the input to Int)
10+
- DOUBLE
11+
- CURRENCY (Formats the values to currency notation)
12+
- VARCHAR (no format check, maxlength: 255)
13+
- TEXT (no format check)
14+
- DATE (Dateformat, automatic conversion to timestamps)
15+
16+
Formtype:
17+
- TEXT (Textfield)
18+
- TEXTAREA (Textarea)
19+
- PASSWORD (Password textfield, input is not shown when edited)
20+
- SELECT (Select option field)
21+
- RADIO
22+
- CHECKBOX
23+
- CHECKBOXARRAY
24+
- FILE
25+
26+
VALUE:
27+
- Wert oder Array
28+
29+
Hint:
30+
The ID field of the database table is not part of the datafield definition.
31+
The ID field must be always auto incement (int or bigint).
32+
33+
34+
*/
35+
36+
$form["title"] = "Web folder user";
37+
$form["description"] = "";
38+
$form["name"] = "web_folder_user";
39+
$form["action"] = "web_folder_user_edit.php";
40+
$form["db_table"] = "web_folder_user";
41+
$form["db_table_idx"] = "web_folder_user_id";
42+
$form["db_history"] = "yes";
43+
$form["tab_default"] = "user";
44+
$form["list_default"] = "web_folder_user_list.php";
45+
$form["auth"] = 'yes'; // yes / no
46+
47+
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
48+
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
49+
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
50+
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
51+
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
52+
53+
$form["tabs"]['user'] = array (
54+
'title' => "Folder",
55+
'width' => 100,
56+
'template' => "templates/web_folder_user_edit.htm",
57+
'fields' => array (
58+
##################################
59+
# Begin Datatable fields
60+
##################################
61+
'server_id' => array (
62+
'datatype' => 'INTEGER',
63+
'formtype' => 'SELECT',
64+
'default' => '',
65+
'datasource' => array ( 'type' => 'SQL',
66+
'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
67+
'keyfield'=> 'server_id',
68+
'valuefield'=> 'server_name'
69+
),
70+
'value' => ''
71+
),
72+
'web_folder_id' => array (
73+
'datatype' => 'INTEGER',
74+
'formtype' => 'SELECT',
75+
'default' => '',
76+
'datasource' => array ( 'type' => 'SQL',
77+
'querystring' => "Select concat(web_domain.domain,' ',web_folder.path) as name, web_folder.web_folder_id from web_domain, web_folder WHERE web_domain.domain_id = web_folder.parent_domain_id AND {AUTHSQL} ORDER BY web_domain.domain",
78+
'keyfield'=> 'web_folder_id',
79+
'valuefield'=> 'name'
80+
),
81+
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
82+
'errmsg'=> 'folder_error_empty'),
83+
),
84+
'value' => ''
85+
),
86+
'username' => array (
87+
'datatype' => 'VARCHAR',
88+
'formtype' => 'TEXT',
89+
'validators' => array ( 0 => array ( 'type' => 'REGEX',
90+
'regex' => '/^[\w\.\-]{0,64}$/',
91+
'errmsg'=> 'username_error_regex'),
92+
),
93+
'default' => '',
94+
'value' => '',
95+
'width' => '30',
96+
'maxlength' => '255'
97+
),
98+
'password' => array (
99+
'datatype' => 'VARCHAR',
100+
'formtype' => 'PASSWORD',
101+
'encryption' => 'CRYPT',
102+
'default' => '',
103+
'value' => '',
104+
'width' => '30',
105+
'maxlength' => '255'
106+
),
107+
'active' => array (
108+
'datatype' => 'VARCHAR',
109+
'formtype' => 'CHECKBOX',
110+
'default' => 'y',
111+
'value' => array(0 => 'n',1 => 'y')
112+
),
113+
##################################
114+
# ENDE Datatable fields
115+
##################################
116+
)
117+
);
118+
119+
120+
121+
122+
?>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
$wb["server_id_txt"] = 'Server';
3+
$wb["parent_domain_id_txt"] = 'Website';
4+
$wb["path_txt"] = 'Path';
5+
$wb["active_txt"] = 'Active';
6+
$wb["path_error_regex"] = 'Invalid folder path.';
7+
?>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
$wb["list_head_txt"] = 'Folder';
3+
$wb["active_txt"] = 'Active';
4+
$wb["server_id_txt"] = 'Server';
5+
$wb["parent_domain_id_txt"] = 'Website';
6+
$wb["path_txt"] = 'Path';
7+
?>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
$wb["web_folder_id_txt"] = 'Folder';
3+
$wb["username_txt"] = 'Username';
4+
$wb["password_txt"] = 'Password';
5+
$wb["active_txt"] = 'Active';
6+
$wb["folder_error_empty"] = 'No web folder selecetd.';
7+
?>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
$wb["list_head_txt"] = 'Folder User';
3+
$wb["active_txt"] = 'Active';
4+
$wb["web_folder_id_txt"] = 'Folder';
5+
$wb["username_txt"] = 'Username';
6+
?>

0 commit comments

Comments
 (0)