Till Brehm
2014-08-13 3ee67a99739154fa5fab3a041edabc14415d4e70
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'),
3ee67a 96                 2 => array(
TB 97                             'type' => 'CUSTOM',
98                             'class' => 'validate_systemuser',
99                             'function' => 'check_sysuser',
100                             'check_names' => true,
101                             'errmsg' => 'invalid_username_txt'
102                         ),
7fe908 103             ),
MC 104             'default' => '',
105             'value'  => '',
106             'width'  => '30',
107             'maxlength' => '255',
4c28d9 108             'searchable' => 1
af8f1b 109         ),
10b4c8 110         'username_prefix' => array (
7fe908 111             'datatype' => 'VARCHAR',
MC 112             'formtype' => 'TEXT',
113             'default' => '',
114             'value'  => '',
115             'width'  => '30',
116             'maxlength' => '25'
10b4c8 117         ),
af8f1b 118         'password' => array (
7fe908 119             'datatype' => 'VARCHAR',
MC 120             'formtype' => 'PASSWORD',
7b9388 121             'validators' => array(
MC 122                 0 => array(
123                     'type' => 'CUSTOM',
124                     'class' => 'validate_password',
125                     'function' => 'password_check',
126                     'errmsg' => 'weak_password_txt'
127                 )
128             ),
af8f1b 129             'encryption' => 'CRYPT',
7fe908 130             'default' => '',
MC 131             'value'  => '',
132             'width'  => '30',
133             'maxlength' => '255'
af8f1b 134         ),
a91fdb 135         'chroot' => array (
7fe908 136             'datatype' => 'VARCHAR',
MC 137             'formtype' => 'SELECT',
138             'default' => '',
95affe 139             'valuelimit' => 'client:ssh_chroot',
7fe908 140             'value'  => array('no' => 'None', 'jailkit' => 'Jailkit')
a91fdb 141         ),
af8f1b 142         'quota_size' => array (
7fe908 143             'datatype' => 'INTEGER',
MC 144             'formtype' => 'TEXT',
145             'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
146                     'errmsg'=> 'quota_size_error_empty'),
147             ),
148             'default' => '-1',
149             'value'  => '',
150             'width'  => '7',
151             'maxlength' => '7'
af8f1b 152         ),
T 153         'active' => array (
7fe908 154             'datatype' => 'VARCHAR',
MC 155             'formtype' => 'CHECKBOX',
156             'default' => 'y',
157             'value'  => array(0 => 'n', 1 => 'y')
af8f1b 158         ),
08c588 159         'ssh_rsa' => array (
7fe908 160             'datatype' => 'VARCHAR',
MC 161             'formtype' => 'TEXT',
162             'default' => '',
163             'value'  => '',
164             'maxlength' => '600'
08c588 165         ),
7fe908 166         //#################################
MC 167         // ENDE Datatable fields
168         //#################################
af8f1b 169     )
T 170 );
171
172 if($_SESSION["s"]["user"]["typ"] == 'admin') {
173
7fe908 174     $form["tabs"]['advanced'] = array (
MC 175         'title'  => "Options",
176         'width'  => 100,
177         'template'  => "templates/shell_user_advanced.htm",
178         'fields'  => array (
179             //#################################
180             // Begin Datatable fields
181             //#################################
182             'puser' => array (
183                 'datatype' => 'VARCHAR',
184                 'formtype' => 'TEXT',
185                 'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
186                         'errmsg'=> 'uid_error_empty'),
e98a15 187                         1 => array(
TB 188                             'type' => 'CUSTOM',
189                             'class' => 'validate_systemuser',
190                             'function' => 'check_sysuser',
191                             'check_names' => true,
192                             'errmsg' => 'invalid_system_user_or_group_txt'
193                         ),
7fe908 194                 ),
MC 195                 'default' => '0',
196                 'value'  => '',
197                 'width'  => '30',
198                 'maxlength' => '255'
199             ),
200             'pgroup' => array (
201                 'datatype' => 'VARCHAR',
202                 'formtype' => 'TEXT',
203                 'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
204                         'errmsg'=> 'uid_error_empty'),
e98a15 205                         1 => array(
TB 206                             'type' => 'CUSTOM',
207                             'class' => 'validate_systemuser',
208                             'function' => 'check_sysgroup',
209                             'check_names' => true,
210                             'errmsg' => 'invalid_system_user_or_group_txt'
211                         ),
7fe908 212                 ),
MC 213                 'default' => '0',
214                 'value'  => '',
215                 'width'  => '30',
216                 'maxlength' => '255'
217             ),
218             'shell' => array (
219                 'datatype' => 'VARCHAR',
220                 'formtype' => 'TEXT',
f2fc77 221                 'validators' => array ( 0 => array (     'type' => 'NOTEMPTY',
TB 222                                                         'errmsg'=> 'shell_error_empty'),
223                                         1 => array (     'type' => 'REGEX',
224                                                             'regex' => '/^\/[a-zA-Z0-9\/]{5,20}$/',
225                                                             'errmsg'=> 'shell_error_regex'),
226                 ),
7fe908 227                 'default' => '/bin/bash',
MC 228                 'value'  => '',
229                 'width'  => '30',
230                 'maxlength' => '255'
231             ),
232             'dir' => array (
233                 'datatype' => 'VARCHAR',
234                 'formtype' => 'TEXT',
f2fc77 235                 'validators' => array ( 0 => array (     'type' => 'NOTEMPTY',
TB 236                                                         'errmsg'=> 'directory_error_empty'),
237                                         1 => array (     'type' => 'REGEX',
238                                                             'regex' => '/^\/[a-zA-Z0-9\ \.\-\_\/]{10,128}$/',
239                                                             'errmsg'=> 'directory_error_regex'),
7fe908 240                 ),
MC 241                 'default' => '',
242                 'value'  => '',
243                 'width'  => '30',
244                 'maxlength' => '255'
245             ),
246             //#################################
247             // ENDE Datatable fields
248             //#################################
249         )
250     );
af8f1b 251
T 252 }
253
254
08c588 255 ?>