Marius Cramer
2014-08-13 42539643c396f9d8865dcf9a51b13dc869709d16
commit | author | age
af8f1b 1 <?php
T 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).
7fe908 32
4c28d9 33     Search:
F 34     - searchable = 1 or searchable = 2 include the field in the search
35     - searchable = 1: this field will be the title of the search result
36     - searchable = 2: this field will be included in the description of the search result
af8f1b 37
T 38
39 */
40
7fe908 41 $form["title"]    = "Shell User";
MC 42 $form["description"]  = "";
43 $form["name"]    = "shell_user";
44 $form["action"]   = "shell_user_edit.php";
45 $form["db_table"]  = "shell_user";
46 $form["db_table_idx"] = "shell_user_id";
47 $form["db_history"]  = "yes";
48 $form["tab_default"] = "shell";
49 $form["list_default"] = "shell_user_list.php";
50 $form["auth"]   = 'yes'; // yes / no
af8f1b 51
T 52 $form["auth_preset"]["userid"]  = 0; // 0 = id of the user, > 0 id must match with id of current user
53 $form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
54 $form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
55 $form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
56 $form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
57
58 $form["tabs"]['shell'] = array (
7fe908 59     'title'  => "Shell User",
MC 60     'width'  => 100,
61     'template'  => "templates/shell_user_edit.htm",
62     'fields'  => array (
63         //#################################
64         // Begin Datatable fields
65         //#################################
af8f1b 66         'server_id' => array (
7fe908 67             'datatype' => 'INTEGER',
MC 68             'formtype' => 'SELECT',
69             'default' => '',
70             'datasource' => array (  'type' => 'SQL',
71                 'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND {AUTHSQL} ORDER BY server_name',
72                 'keyfield'=> 'server_id',
73                 'valuefield'=> 'server_name'
74             ),
75             'value'  => ''
af8f1b 76         ),
T 77         'parent_domain_id' => array (
7fe908 78             'datatype' => 'INTEGER',
MC 79             'formtype' => 'SELECT',
80             'default' => '',
81             'datasource' => array (  'type' => 'SQL',
82                 'querystring' => "SELECT web_domain.domain_id, CONCAT(web_domain.domain, ' :: ', server.server_name) AS parent_domain FROM web_domain, server WHERE web_domain.type = 'vhost' AND web_domain.server_id = server.server_id AND {AUTHSQL::web_domain} ORDER BY web_domain.domain",
83                 'keyfield'=> 'domain_id',
84                 'valuefield'=> 'parent_domain'
85             ),
86             'value'  => ''
af8f1b 87         ),
T 88         'username' => array (
7fe908 89             'datatype' => 'VARCHAR',
MC 90             'formtype' => 'TEXT',
91             'validators' => array (  0 => array ( 'type' => 'UNIQUE',
92                     'errmsg'=> 'username_error_unique'),
93                 1 => array ( 'type' => 'REGEX',
94                     'regex' => '/^[\w\.\-]{0,32}$/',
95                     'errmsg'=> 'username_error_regex'),
96             ),
97             'default' => '',
98             'value'  => '',
99             'width'  => '30',
100             'maxlength' => '255',
4c28d9 101             'searchable' => 1
af8f1b 102         ),
10b4c8 103         'username_prefix' => array (
7fe908 104             'datatype' => 'VARCHAR',
MC 105             'formtype' => 'TEXT',
106             'default' => '',
107             'value'  => '',
108             'width'  => '30',
109             'maxlength' => '25'
10b4c8 110         ),
af8f1b 111         'password' => array (
7fe908 112             'datatype' => 'VARCHAR',
MC 113             'formtype' => 'PASSWORD',
7b9388 114             'validators' => array(
MC 115                 0 => array(
116                     'type' => 'CUSTOM',
117                     'class' => 'validate_password',
118                     'function' => 'password_check',
119                     'errmsg' => 'weak_password_txt'
120                 )
121             ),
af8f1b 122             'encryption' => 'CRYPT',
7fe908 123             'default' => '',
MC 124             'value'  => '',
125             'width'  => '30',
126             'maxlength' => '255'
af8f1b 127         ),
a91fdb 128         'chroot' => array (
7fe908 129             'datatype' => 'VARCHAR',
MC 130             'formtype' => 'SELECT',
131             'default' => '',
95affe 132             'valuelimit' => 'client:ssh_chroot',
7fe908 133             'value'  => array('no' => 'None', 'jailkit' => 'Jailkit')
a91fdb 134         ),
af8f1b 135         'quota_size' => array (
7fe908 136             'datatype' => 'INTEGER',
MC 137             'formtype' => 'TEXT',
138             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
139                     'errmsg'=> 'quota_size_error_empty'),
140             ),
141             'default' => '-1',
142             'value'  => '',
143             'width'  => '7',
144             'maxlength' => '7'
af8f1b 145         ),
T 146         'active' => array (
7fe908 147             'datatype' => 'VARCHAR',
MC 148             'formtype' => 'CHECKBOX',
149             'default' => 'y',
150             'value'  => array(0 => 'n', 1 => 'y')
af8f1b 151         ),
08c588 152         'ssh_rsa' => array (
7fe908 153             'datatype' => 'VARCHAR',
MC 154             'formtype' => 'TEXT',
155             'default' => '',
156             'value'  => '',
157             'maxlength' => '600'
08c588 158         ),
7fe908 159         //#################################
MC 160         // ENDE Datatable fields
161         //#################################
af8f1b 162     )
T 163 );
164
165 if($_SESSION["s"]["user"]["typ"] == 'admin') {
166
7fe908 167     $form["tabs"]['advanced'] = array (
MC 168         'title'  => "Options",
169         'width'  => 100,
170         'template'  => "templates/shell_user_advanced.htm",
171         'fields'  => array (
172             //#################################
173             // Begin Datatable fields
174             //#################################
175             'puser' => array (
176                 'datatype' => 'VARCHAR',
177                 'formtype' => 'TEXT',
178                 'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
179                         'errmsg'=> 'uid_error_empty'),
e98a15 180                         1 => array(
TB 181                             'type' => 'CUSTOM',
182                             'class' => 'validate_systemuser',
183                             'function' => 'check_sysuser',
184                             'check_names' => true,
185                             'errmsg' => 'invalid_system_user_or_group_txt'
186                         ),
7fe908 187                 ),
MC 188                 'default' => '0',
189                 'value'  => '',
190                 'width'  => '30',
191                 'maxlength' => '255'
192             ),
193             'pgroup' => array (
194                 'datatype' => 'VARCHAR',
195                 'formtype' => 'TEXT',
196                 'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
197                         'errmsg'=> 'uid_error_empty'),
e98a15 198                         1 => array(
TB 199                             'type' => 'CUSTOM',
200                             'class' => 'validate_systemuser',
201                             'function' => 'check_sysgroup',
202                             'check_names' => true,
203                             'errmsg' => 'invalid_system_user_or_group_txt'
204                         ),
7fe908 205                 ),
MC 206                 'default' => '0',
207                 'value'  => '',
208                 'width'  => '30',
209                 'maxlength' => '255'
210             ),
211             'shell' => array (
212                 'datatype' => 'VARCHAR',
213                 'formtype' => 'TEXT',
f2fc77 214                 'validators' => array ( 0 => array (     'type' => 'NOTEMPTY',
TB 215                                                         'errmsg'=> 'shell_error_empty'),
216                                         1 => array (     'type' => 'REGEX',
217                                                             'regex' => '/^\/[a-zA-Z0-9\/]{5,20}$/',
218                                                             'errmsg'=> 'shell_error_regex'),
219                 ),
7fe908 220                 'default' => '/bin/bash',
MC 221                 'value'  => '',
222                 'width'  => '30',
223                 'maxlength' => '255'
224             ),
225             'dir' => array (
226                 'datatype' => 'VARCHAR',
227                 'formtype' => 'TEXT',
f2fc77 228                 'validators' => array ( 0 => array (     'type' => 'NOTEMPTY',
TB 229                                                         'errmsg'=> 'directory_error_empty'),
230                                         1 => array (     'type' => 'REGEX',
231                                                             'regex' => '/^\/[a-zA-Z0-9\ \.\-\_\/]{10,128}$/',
232                                                             'errmsg'=> 'directory_error_regex'),
7fe908 233                 ),
MC 234                 'default' => '',
235                 'value'  => '',
236                 'width'  => '30',
237                 'maxlength' => '255'
238             ),
239             //#################################
240             // ENDE Datatable fields
241             //#################################
242         )
243     );
af8f1b 244
T 245 }
246
247
08c588 248 ?>