1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
system_usermanager.php
|
5
|
part of m0n0wall (http://m0n0.ch/wall)
|
6
|
|
7
|
Copyright (C) 2008 Shrew Soft Inc.
|
8
|
All rights reserved.
|
9
|
|
10
|
Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>.
|
11
|
All rights reserved.
|
12
|
|
13
|
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
|
14
|
All rights reserved.
|
15
|
|
16
|
Redistribution and use in source and binary forms, with or without
|
17
|
modification, are permitted provided that the following conditions are met:
|
18
|
|
19
|
1. Redistributions of source code must retain the above copyright notice,
|
20
|
this list of conditions and the following disclaimer.
|
21
|
|
22
|
2. Redistributions in binary form must reproduce the above copyright
|
23
|
notice, this list of conditions and the following disclaimer in the
|
24
|
documentation and/or other materials provided with the distribution.
|
25
|
|
26
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
27
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
28
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
29
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
30
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
31
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
32
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
33
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
34
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
35
|
POSSIBILITY OF SUCH DAMAGE.
|
36
|
*/
|
37
|
|
38
|
##|+PRIV
|
39
|
##|*IDENT=page-system-usermanager
|
40
|
##|*NAME=System: User Manager page
|
41
|
##|*DESCR=Allow access to the 'System: User Manager' page.
|
42
|
##|*MATCH=system_usermanager.php*
|
43
|
##|-PRIV
|
44
|
|
45
|
|
46
|
require("guiconfig.inc");
|
47
|
|
48
|
if (isAllowedPage("system_usermanager")) {
|
49
|
|
50
|
// start admin user code
|
51
|
$pgtitle = array("System","User Manager");
|
52
|
|
53
|
$id = $_GET['id'];
|
54
|
if (isset($_POST['id']))
|
55
|
$id = $_POST['id'];
|
56
|
|
57
|
if (!is_array($config['system']['user']))
|
58
|
$config['system']['user'] = array();
|
59
|
|
60
|
admin_users_sort();
|
61
|
$a_user = &$config['system']['user'];
|
62
|
|
63
|
if ($_GET['act'] == "deluser") {
|
64
|
|
65
|
if (!$a_user[$id]) {
|
66
|
pfSenseHeader("system_usermanager.php");
|
67
|
exit;
|
68
|
}
|
69
|
|
70
|
local_user_del($a_user[$id]);
|
71
|
$userdeleted = $a_user[$id]['name'];
|
72
|
unset($a_user[$id]);
|
73
|
write_config();
|
74
|
$savemsg = gettext("User")." {$userdeleted} ".
|
75
|
gettext("successfully deleted")."<br/>";
|
76
|
}
|
77
|
|
78
|
if ($_GET['act'] == "delpriv") {
|
79
|
|
80
|
if (!$a_user[$id]) {
|
81
|
pfSenseHeader("system_usermanager.php");
|
82
|
exit;
|
83
|
}
|
84
|
|
85
|
$privdeleted = $priv_list[$a_user[$id]['priv'][$_GET['privid']]]['name'];
|
86
|
unset($a_user[$id]['priv'][$_GET['privid']]);
|
87
|
write_config();
|
88
|
$_GET['act'] = "edit";
|
89
|
$savemsg = gettext("Privilege")." {$privdeleted} ".
|
90
|
gettext("successfully deleted")."<br/>";
|
91
|
}
|
92
|
|
93
|
if ($_GET['act'] == "expcert") {
|
94
|
|
95
|
if (!$a_user[$id]) {
|
96
|
pfSenseHeader("system_usermanager.php");
|
97
|
exit;
|
98
|
}
|
99
|
|
100
|
$cert =& $a_user[$id]['cert'][$_GET['certid']];
|
101
|
|
102
|
$exp_name = urlencode("{$a_user[$id]['name']}-{$cert['name']}.crt");
|
103
|
$exp_data = base64_decode($cert['crt']);
|
104
|
$exp_size = strlen($exp_data);
|
105
|
|
106
|
header("Content-Type: application/octet-stream");
|
107
|
header("Content-Disposition: attachment; filename={$exp_name}");
|
108
|
header("Content-Length: $exp_size");
|
109
|
echo $exp_data;
|
110
|
exit;
|
111
|
}
|
112
|
|
113
|
if ($_GET['act'] == "expckey") {
|
114
|
|
115
|
if (!$a_user[$id]) {
|
116
|
pfSenseHeader("system_usermanager.php");
|
117
|
exit;
|
118
|
}
|
119
|
|
120
|
$cert =& $a_user[$id]['cert'][$_GET['certid']];
|
121
|
|
122
|
$exp_name = urlencode("{$a_user[$id]['name']}-{$cert['name']}.key");
|
123
|
$exp_data = base64_decode($cert['prv']);
|
124
|
$exp_size = strlen($exp_data);
|
125
|
|
126
|
header("Content-Type: application/octet-stream");
|
127
|
header("Content-Disposition: attachment; filename={$exp_name}");
|
128
|
header("Content-Length: $exp_size");
|
129
|
echo $exp_data;
|
130
|
exit;
|
131
|
}
|
132
|
|
133
|
if ($_GET['act'] == "delcert") {
|
134
|
|
135
|
if (!$a_user[$id]) {
|
136
|
pfSenseHeader("system_usermanager.php");
|
137
|
exit;
|
138
|
}
|
139
|
|
140
|
$certdeleted = $a_user[$id]['cert'][$_GET['certid']]['name'];
|
141
|
unset($a_user[$id]['cert'][$_GET['certid']]);
|
142
|
write_config();
|
143
|
$_GET['act'] = "edit";
|
144
|
$savemsg = gettext("Certificate")." {$certdeleted} ".
|
145
|
gettext("successfully deleted")."<br/>";
|
146
|
}
|
147
|
|
148
|
if ($_GET['act'] == "edit") {
|
149
|
if (isset($id) && $a_user[$id]) {
|
150
|
$pconfig['usernamefld'] = $a_user[$id]['name'];
|
151
|
$pconfig['fullname'] = $a_user[$id]['fullname'];
|
152
|
$pconfig['groups'] = local_user_get_groups($a_user[$id]);
|
153
|
$pconfig['utype'] = $a_user[$id]['scope'];
|
154
|
$pconfig['uid'] = $a_user[$id]['uid'];
|
155
|
$pconfig['authorizedkeys'] = base64_decode($a_user[$id]['authorizedkeys']);
|
156
|
$pconfig['priv'] = $a_user[$id]['priv'];
|
157
|
}
|
158
|
}
|
159
|
|
160
|
if ($_GET['act'] == "new") {
|
161
|
/*
|
162
|
* set this value cause the text field is read only
|
163
|
* and the user should not be able to mess with this
|
164
|
* setting.
|
165
|
*/
|
166
|
$pconfig['utype'] = "user";
|
167
|
}
|
168
|
|
169
|
if ($_POST) {
|
170
|
unset($input_errors);
|
171
|
$pconfig = $_POST;
|
172
|
|
173
|
/* input validation */
|
174
|
if (isset($id) && ($a_user[$id])) {
|
175
|
$reqdfields = explode(" ", "usernamefld");
|
176
|
$reqdfieldsn = explode(",", "Username");
|
177
|
} else {
|
178
|
$reqdfields = explode(" ", "usernamefld passwordfld1");
|
179
|
$reqdfieldsn = explode(",", "Username,Password");
|
180
|
}
|
181
|
|
182
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
183
|
|
184
|
if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['usernamefld']))
|
185
|
$input_errors[] = gettext("The username contains invalid characters.");
|
186
|
|
187
|
if (($_POST['passwordfld1']) && ($_POST['passwordfld1'] != $_POST['passwordfld2']))
|
188
|
$input_errors[] = gettext("The passwords do not match.");
|
189
|
|
190
|
/* make sure this user name is unique */
|
191
|
if (!$input_errors && !(isset($id) && $a_user[$id])) {
|
192
|
foreach ($a_user as $userent) {
|
193
|
if ($userent['name'] == $_POST['usernamefld']) {
|
194
|
$input_errors[] = gettext("Another entry with the same username already exists.");
|
195
|
break;
|
196
|
}
|
197
|
}
|
198
|
}
|
199
|
|
200
|
if (isset($config['system']['ssh']['sshdkeyonly']) && empty($_POST['authorizedkeys']))
|
201
|
$input_errors[] = gettext("You must provide an authorized key otherwise you won't be able to login into this system.");
|
202
|
|
203
|
/* if this is an AJAX caller then handle via JSON */
|
204
|
if (isAjax() && is_array($input_errors)) {
|
205
|
input_errors2Ajax($input_errors);
|
206
|
exit;
|
207
|
}
|
208
|
|
209
|
if (!$input_errors) {
|
210
|
$userent = array();
|
211
|
if (isset($id) && $a_user[$id])
|
212
|
$userent = $a_user[$id];
|
213
|
|
214
|
isset($_POST['utype']) ? $userent['scope'] = $_POST['utype'] : $userent['scope'] = "system";
|
215
|
|
216
|
/* the user name was modified */
|
217
|
if ($_POST['usernamefld'] <> $_POST['oldusername'])
|
218
|
$_SERVER['REMOTE_USER'] = $_POST['usernamefld'];
|
219
|
|
220
|
/* the user password was mofified */
|
221
|
if ($_POST['passwordfld1'])
|
222
|
local_user_set_password($userent, $_POST['passwordfld1']);
|
223
|
|
224
|
$userent['name'] = $_POST['usernamefld'];
|
225
|
$userent['fullname'] = $_POST['fullname'];
|
226
|
$userent['authorizedkeys'] = base64_encode($_POST['authorizedkeys']);
|
227
|
|
228
|
if (isset($id) && $a_user[$id])
|
229
|
$a_user[$id] = $userent;
|
230
|
else {
|
231
|
$userent['uid'] = $config['system']['nextuid']++;
|
232
|
$a_user[] = $userent;
|
233
|
}
|
234
|
|
235
|
local_user_set($userent);
|
236
|
local_user_set_groups($userent,$_POST['groups']);
|
237
|
write_config();
|
238
|
|
239
|
pfSenseHeader("system_usermanager.php");
|
240
|
}
|
241
|
}
|
242
|
|
243
|
include("head.inc");
|
244
|
?>
|
245
|
|
246
|
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
|
247
|
<?php include("fbegin.inc"); ?>
|
248
|
<script language="JavaScript">
|
249
|
<!--
|
250
|
|
251
|
function setall_selected(id) {
|
252
|
selbox = document.getElementById(id);
|
253
|
count = selbox.options.length;
|
254
|
for (index = 0; index<count; index++)
|
255
|
selbox.options[index].selected = true;
|
256
|
}
|
257
|
|
258
|
function clear_selected(id) {
|
259
|
selbox = document.getElementById(id);
|
260
|
count = selbox.options.length;
|
261
|
for (index = 0; index<count; index++)
|
262
|
selbox.options[index].selected = false;
|
263
|
}
|
264
|
|
265
|
function remove_selected(id) {
|
266
|
selbox = document.getElementById(id);
|
267
|
index = selbox.options.length - 1;
|
268
|
for (; index >= 0; index--)
|
269
|
if (selbox.options[index].selected)
|
270
|
selbox.remove(index);
|
271
|
}
|
272
|
|
273
|
function copy_selected(srcid, dstid) {
|
274
|
src_selbox = document.getElementById(srcid);
|
275
|
dst_selbox = document.getElementById(dstid);
|
276
|
count = src_selbox.options.length;
|
277
|
for (index = 0; index < count; index++) {
|
278
|
if (src_selbox.options[index].selected) {
|
279
|
option = document.createElement('option');
|
280
|
option.text = src_selbox.options[index].text;
|
281
|
option.value = src_selbox.options[index].value;
|
282
|
dst_selbox.add(option, null);
|
283
|
}
|
284
|
}
|
285
|
}
|
286
|
|
287
|
function move_selected(srcid, dstid) {
|
288
|
copy_selected(srcid, dstid);
|
289
|
remove_selected(srcid);
|
290
|
}
|
291
|
|
292
|
function presubmit() {
|
293
|
clear_selected('notgroups');
|
294
|
setall_selected('groups');
|
295
|
}
|
296
|
|
297
|
//-->
|
298
|
</script>
|
299
|
<?php
|
300
|
if ($input_errors)
|
301
|
print_input_errors($input_errors);
|
302
|
if ($savemsg)
|
303
|
print_info_box($savemsg);
|
304
|
?>
|
305
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
306
|
<tr>
|
307
|
<td class="tabnavtbl">
|
308
|
<?php
|
309
|
$tab_array = array();
|
310
|
$tab_array[] = array(gettext("Users"), true, "system_usermanager.php");
|
311
|
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
|
312
|
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
|
313
|
$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
|
314
|
display_top_tabs($tab_array);
|
315
|
?>
|
316
|
</td>
|
317
|
</tr>
|
318
|
<tr>
|
319
|
<td class="tabcont">
|
320
|
|
321
|
<?php if ($_GET['act'] == "new" || $_GET['act'] == "edit" || $input_errors): ?>
|
322
|
|
323
|
<form action="system_usermanager.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
|
324
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
325
|
<?php
|
326
|
$ro = "";
|
327
|
if ($pconfig['utype'] == "system")
|
328
|
$ro = "readonly = \"readonly\"";
|
329
|
?>
|
330
|
<tr>
|
331
|
<td width="22%" valign="top" class="vncell"><?=gettext("Defined by");?></td>
|
332
|
<td width="78%" class="vtable">
|
333
|
<strong><?=strtoupper($pconfig['utype']);?></strong>
|
334
|
<input name="utype" type="hidden" value="<?=$pconfig['utype']?>"/>
|
335
|
</td>
|
336
|
</tr>
|
337
|
<tr>
|
338
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Username");?></td>
|
339
|
<td width="78%" class="vtable">
|
340
|
<input name="usernamefld" type="text" class="formfld user" id="usernamefld" size="20" value="<?=htmlspecialchars($pconfig['usernamefld']);?>" <?=$ro;?>/>
|
341
|
<input name="oldusername" type="hidden" id="oldusername" value="<?=htmlspecialchars($pconfig['usernamefld']);?>" />
|
342
|
</td>
|
343
|
</tr>
|
344
|
<tr>
|
345
|
<td width="22%" valign="top" class="vncellreq" rowspan="2"><?=gettext("Password");?></td>
|
346
|
<td width="78%" class="vtable">
|
347
|
<input name="passwordfld1" type="password" class="formfld pwd" id="passwordfld1" size="20" value="" />
|
348
|
</td>
|
349
|
</tr>
|
350
|
<tr>
|
351
|
<td width="78%" class="vtable">
|
352
|
<input name="passwordfld2" type="password" class="formfld pwd" id="passwordfld2" size="20" value="" /> <?= gettext("(confirmation)"); ?>
|
353
|
</td>
|
354
|
</tr>
|
355
|
<tr>
|
356
|
<td width="22%" valign="top" class="vncell"><?=gettext("Full name");?></td>
|
357
|
<td width="78%" class="vtable">
|
358
|
<input name="fullname" type="text" class="formfld unknown" id="fullname" size="20" value="<?=htmlspecialchars($pconfig['fullname']);?>" <?=$ro;?>/>
|
359
|
<br/>
|
360
|
<?=gettext("User's full name, for your own information only");?>
|
361
|
</td>
|
362
|
</tr>
|
363
|
<tr>
|
364
|
<td width="22%" valign="top" class="vncell"><?=gettext("Group Memberships");?></td>
|
365
|
<td width="78%" class="vtable" align="center">
|
366
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
367
|
<tr>
|
368
|
<td align="center" width="50%">
|
369
|
<strong>Not Member Of</strong><br/>
|
370
|
<br/>
|
371
|
<select size="10" style="width: 75%" name="notgroups[]" class="formselect" id="notgroups" onChange="clear_selected('groups')" multiple>
|
372
|
<?php
|
373
|
foreach ($config['system']['group'] as $group):
|
374
|
if ($group['gid'] == 1998) /* all users group */
|
375
|
continue;
|
376
|
if (in_array($group['name'],$pconfig['groups']))
|
377
|
continue;
|
378
|
?>
|
379
|
<option value="<?=$group['name'];?>" <?=$selected;?>>
|
380
|
<?=htmlspecialchars($group['name']);?>
|
381
|
</option>
|
382
|
<?php endforeach; ?>
|
383
|
</select>
|
384
|
<br/>
|
385
|
</td>
|
386
|
<td>
|
387
|
<br/>
|
388
|
<a href="javascript:move_selected('notgroups','groups')">
|
389
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_right.gif" title="Add Groups" alt="Add Groups" width="17" height="17" border="0" />
|
390
|
</a>
|
391
|
<br/><br/>
|
392
|
<a href="javascript:move_selected('groups','notgroups')">
|
393
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_left.gif" title="Remove Groups" alt="Remove Groups" width="17" height="17" border="0" />
|
394
|
</a>
|
395
|
</td>
|
396
|
<td align="center" width="50%">
|
397
|
<strong>Member Of</strong><br/>
|
398
|
<br/>
|
399
|
<select size="10" style="width: 75%" name="groups[]" class="formselect" id="groups" onChange="clear_selected('nogroups')" multiple>
|
400
|
<?php
|
401
|
foreach ($config['system']['group'] as $group):
|
402
|
if ($group['gid'] == 1998) /* all users group */
|
403
|
continue;
|
404
|
if (!in_array($group['name'],$pconfig['groups']))
|
405
|
continue;
|
406
|
?>
|
407
|
<option value="<?=$group['name'];?>">
|
408
|
<?=htmlspecialchars($group['name']);?>
|
409
|
</option>
|
410
|
<?php endforeach; ?>
|
411
|
</select>
|
412
|
<br/>
|
413
|
</td>
|
414
|
</tr>
|
415
|
</table>
|
416
|
<?=gettext("Hold down CTRL (pc)/COMMAND (mac) key to select multiple items");?>
|
417
|
</td>
|
418
|
</tr>
|
419
|
|
420
|
<?php if ($pconfig['uid']): ?>
|
421
|
|
422
|
<tr>
|
423
|
<td width="22%" valign="top" class="vncell"><?=gettext("Effective Privileges");?></td>
|
424
|
<td width="78%" class="vtable">
|
425
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
426
|
<tr>
|
427
|
<td width="20%" class="listhdrr"><?=gettext("Inherited From");?></td>
|
428
|
<td width="30%" class="listhdrr"><?=gettext("Name");?></td>
|
429
|
<td width="40%" class="listhdrr"><?=gettext("Description");?></td>
|
430
|
<td class="list"></td>
|
431
|
</tr>
|
432
|
<?php
|
433
|
|
434
|
$privdesc = get_user_privdesc($a_user[$id]);
|
435
|
if(is_array($privdesc)):
|
436
|
$i = 0;
|
437
|
foreach ($privdesc as $priv):
|
438
|
$group = false;
|
439
|
if ($priv['group'])
|
440
|
$group = $priv['group'];
|
441
|
?>
|
442
|
<tr>
|
443
|
<td class="listlr"><?=$group;?></td>
|
444
|
<td class="listr">
|
445
|
<?=htmlspecialchars($priv['name']);?>
|
446
|
</td>
|
447
|
<td class="listbg">
|
448
|
<font color="#FFFFFF">
|
449
|
<?=htmlspecialchars($priv['descr']);?>
|
450
|
</font>
|
451
|
</td>
|
452
|
<td valign="middle" nowrap class="list">
|
453
|
<?php if (!$group): ?>
|
454
|
<a href="system_usermanager.php?act=delpriv&id=<?=$id?>&privid=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this privilege?");?>')">
|
455
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="" />
|
456
|
</a>
|
457
|
<?php endif; ?>
|
458
|
</td>
|
459
|
</tr>
|
460
|
<?php
|
461
|
/* can only delete user priv indexes */
|
462
|
if (!$group)
|
463
|
$i++;
|
464
|
endforeach;
|
465
|
endif;
|
466
|
?>
|
467
|
<tr>
|
468
|
<td class="list" colspan="3"></td>
|
469
|
<td class="list">
|
470
|
<a href="system_usermanager_addprivs.php?userid=<?=$id?>">
|
471
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="" />
|
472
|
</a>
|
473
|
</td>
|
474
|
</tr>
|
475
|
</table>
|
476
|
</td>
|
477
|
</tr>
|
478
|
<tr>
|
479
|
<td width="22%" valign="top" class="vncell"><?=gettext("User Certificates");?></td>
|
480
|
<td width="78%" class="vtable">
|
481
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
482
|
<tr>
|
483
|
<td width="45%" class="listhdrr"><?=gettext("Name");?></td>
|
484
|
<td width="45%" class="listhdrr"><?=gettext("CA");?></td>
|
485
|
<td class="list"></td>
|
486
|
</tr>
|
487
|
<?php
|
488
|
|
489
|
$a_cert = $a_user[$id]['cert'];
|
490
|
if(is_array($a_cert)):
|
491
|
$i = 0;
|
492
|
foreach ($a_cert as $cert):
|
493
|
$ca = lookup_ca($cert['caref']);
|
494
|
?>
|
495
|
<tr>
|
496
|
<td class="listlr">
|
497
|
<?=htmlspecialchars($cert['name']);?>
|
498
|
</td>
|
499
|
<td class="listr">
|
500
|
<?=htmlspecialchars($ca['name']);?>
|
501
|
</td>
|
502
|
<td valign="middle" nowrap class="list">
|
503
|
<a href="system_usermanager.php?act=expckey&id=<?=$id;?>&certid=<?=$i;?>">
|
504
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="export private key" alt="export private key" width="17" height="17" border="0" />
|
505
|
</a>
|
506
|
<a href="system_usermanager.php?act=expcert&id=<?=$id;?>&certid=<?=$i;?>">
|
507
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_down.gif" title="export cert" alt="export cert" width="17" height="17" border="0" />
|
508
|
</a>
|
509
|
<a href="system_usermanager.php?act=delcert&id=<?=$id?>&certid=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this certificate?");?>')">
|
510
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete cert" />
|
511
|
</a>
|
512
|
</td>
|
513
|
</tr>
|
514
|
<?php
|
515
|
$i++;
|
516
|
endforeach;
|
517
|
endif;
|
518
|
?>
|
519
|
<tr>
|
520
|
<td class="list" colspan="2"></td>
|
521
|
<td class="list">
|
522
|
<a href="system_usermanager_addcert.php?userid=<?=$id?>">
|
523
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="" />
|
524
|
</a>
|
525
|
</td>
|
526
|
</tr>
|
527
|
</table>
|
528
|
</td>
|
529
|
</tr>
|
530
|
|
531
|
<?php endif; ?>
|
532
|
|
533
|
<tr>
|
534
|
<td width="22%" valign="top" class="vncell"><?=gettext("Authorized keys");?></td>
|
535
|
<td width="78%" class="vtable">
|
536
|
<textarea name="authorizedkeys" cols="65" rows="7" id="authorizedkeys" class="formfld_cert" wrap="off"><?=htmlspecialchars($pconfig['authorizedkeys']);?></textarea>
|
537
|
<br/>
|
538
|
<?=gettext("Paste an authorized keys file here.");?>
|
539
|
</td>
|
540
|
</tr>
|
541
|
<tr>
|
542
|
<td width="22%" valign="top"> </td>
|
543
|
<td width="78%">
|
544
|
<input id="submit" name="save" type="submit" class="formbtn" value="Save" />
|
545
|
<?php if (isset($id) && $a_user[$id]): ?>
|
546
|
<input name="id" type="hidden" value="<?=$id;?>" />
|
547
|
<?php endif;?>
|
548
|
</td>
|
549
|
</tr>
|
550
|
</table>
|
551
|
</form>
|
552
|
|
553
|
<?php else: ?>
|
554
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
555
|
<tr>
|
556
|
<td width="25%" class="listhdrr">Username</td>
|
557
|
<td width="25%" class="listhdrr">Full name</td>
|
558
|
<td width="30%" class="listhdrr">Groups</td>
|
559
|
<td width="10%" class="list"></td>
|
560
|
</tr>
|
561
|
<?php
|
562
|
$i = 0;
|
563
|
foreach($a_user as $userent):
|
564
|
?>
|
565
|
<tr ondblclick="document.location='system_usermanager.php?act=edit&id=<?=$i;?>'">
|
566
|
<td class="listlr">
|
567
|
<table border="0" cellpadding="0" cellspacing="0">
|
568
|
<tr>
|
569
|
<td align="left" valign="center">
|
570
|
<?php
|
571
|
if($userent['scope'] != "user")
|
572
|
$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user-grey.png";
|
573
|
else
|
574
|
$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user.png";
|
575
|
?>
|
576
|
<img src="<?=$usrimg;?>" alt="User" title="User" border="0" height="16" width="16" />
|
577
|
</td>
|
578
|
<td align="left" valign="middle">
|
579
|
<?=htmlspecialchars($userent['name']);?>
|
580
|
</td>
|
581
|
</tr>
|
582
|
</table>
|
583
|
</td>
|
584
|
<td class="listr"><?=htmlspecialchars($userent['fullname']);?> </td>
|
585
|
<td class="listbg">
|
586
|
<font color="white">
|
587
|
<?=implode(",",local_user_get_groups($userent));?>
|
588
|
</font>
|
589
|
|
590
|
</td>
|
591
|
<td valign="middle" nowrap class="list">
|
592
|
<a href="system_usermanager.php?act=edit&id=<?=$i;?>">
|
593
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="edit user" alt="edit user" width="17" height="17" border="0" />
|
594
|
</a>
|
595
|
<?php if($userent['scope'] != "system"): ?>
|
596
|
|
597
|
<a href="system_usermanager.php?act=deluser&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this User?");?>')">
|
598
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="delete user" alt="delete user" width="17" height="17" border="0" />
|
599
|
</a>
|
600
|
<?php endif; ?>
|
601
|
</td>
|
602
|
</tr>
|
603
|
<?php
|
604
|
$i++;
|
605
|
endforeach;
|
606
|
?>
|
607
|
<tr>
|
608
|
<td class="list" colspan="3"></td>
|
609
|
<td class="list">
|
610
|
<a href="system_usermanager.php?act=new">
|
611
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="add user" alt="add user" width="17" height="17" border="0" />
|
612
|
</a>
|
613
|
</td>
|
614
|
</tr>
|
615
|
<tr>
|
616
|
<td colspan="3">
|
617
|
<p>
|
618
|
<?=gettext("Additional webConfigurator users can be added here.");?>
|
619
|
<?=gettext("User permissions can be assinged diretly or inherited from group memberships.");?>
|
620
|
<?=gettext("An icon that appears grey indicates that it is a system defined object.");?>
|
621
|
<?=gettext("Some system object properties can be modified but they cannot be deleted.");?>
|
622
|
</p>
|
623
|
</td>
|
624
|
</tr>
|
625
|
</table>
|
626
|
|
627
|
<?php endif; ?>
|
628
|
|
629
|
</td>
|
630
|
</tr>
|
631
|
</table>
|
632
|
<?php include("fend.inc");?>
|
633
|
</body>
|
634
|
|
635
|
<?php
|
636
|
|
637
|
// end admin user code
|
638
|
|
639
|
} else {
|
640
|
|
641
|
// start normal user code
|
642
|
|
643
|
$pgtitle = array("System","User Password");
|
644
|
|
645
|
if (isset($_POST['save'])) {
|
646
|
unset($input_errors);
|
647
|
|
648
|
/* input validation */
|
649
|
$reqdfields = explode(" ", "passwordfld1");
|
650
|
$reqdfieldsn = explode(",", "Password");
|
651
|
|
652
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
653
|
|
654
|
if ($_POST['passwordfld1'] != $_POST['passwordfld2'])
|
655
|
$input_errors[] = "The passwords do not match.";
|
656
|
|
657
|
if (!$input_errors) {
|
658
|
// all values are okay --> saving changes
|
659
|
$config['system']['user'][$userindex[$HTTP_SERVER_VARS['AUTH_USER']]]['password'] = crypt(trim($_POST['passwordfld1']));
|
660
|
|
661
|
write_config();
|
662
|
$savemsg = "Password successfully changed<br />";
|
663
|
}
|
664
|
}
|
665
|
|
666
|
/* deterimine if user is not local to system */
|
667
|
$islocal = false;
|
668
|
foreach($config['system']['user'] as $user)
|
669
|
if($user['name'] == $_SESSION['Username'])
|
670
|
$islocal = true;
|
671
|
?>
|
672
|
|
673
|
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
|
674
|
<?php
|
675
|
include("head.inc");
|
676
|
include("fbegin.inc");
|
677
|
if ($input_errors)
|
678
|
print_input_errors($input_errors);
|
679
|
if ($savemsg)
|
680
|
print_info_box($savemsg);
|
681
|
|
682
|
if($islocal == false) {
|
683
|
echo "Sorry, you cannot change the password for a LDAP user.";
|
684
|
include("fend.inc");
|
685
|
exit;
|
686
|
}
|
687
|
?>
|
688
|
<form action="system_usermanager.php" method="post" name="iform" id="iform">
|
689
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
690
|
<tr>
|
691
|
<td colspan="2" valign="top" class="listtopic"><?=$HTTP_SERVER_VARS['AUTH_USER']?>'s Password</td>
|
692
|
</tr>
|
693
|
<tr>
|
694
|
<td width="22%" valign="top" class="vncell" rowspan="2">Password</td>
|
695
|
<td width="78%" class="vtable">
|
696
|
<input name="passwordfld1" type="password" class="formfld pwd" id="passwordfld1" size="20" />
|
697
|
</td>
|
698
|
</tr>
|
699
|
<tr>
|
700
|
<td width="78%" class="vtable">
|
701
|
<input name="passwordfld2" type="password" class="formfld pwd" id="passwordfld2" size="20" />
|
702
|
<?=gettext("(confirmation)");?>
|
703
|
<br/>
|
704
|
<span class="vexpl">
|
705
|
<?=gettext("Select a new password");?>
|
706
|
</span>
|
707
|
</td>
|
708
|
</tr>
|
709
|
<tr>
|
710
|
<td width="22%" valign="top"> </td>
|
711
|
<td width="78%">
|
712
|
<input name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
|
713
|
</td>
|
714
|
</tr>
|
715
|
</table>
|
716
|
</form>
|
717
|
<?php include("fend.inc");?>
|
718
|
</body>
|
719
|
|
720
|
<?php
|
721
|
|
722
|
} // end of normal user code
|
723
|
|
724
|
?>
|