Project

General

Profile

Download (13.6 KB) Statistics
| Branch: | Tag: | Revision:
1 4c291f4c Renato Botelho
<?php
2 fab7ff44 Bill Marquette
/*
3 919d91f9 Phil Davis
	system_groupmanager.php
4 fab7ff44 Bill Marquette
*/
5 f74457df Stephen Beaver
/* ====================================================================
6
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
7 cb41dd63 Renato Botelho
 *	Copyright (c)  2005 Paul Taylor <paultaylor@winn-dixie.com>
8
 *	Copyright (c)  2008 Shrew Soft Inc
9 191cb31d Stephen Beaver
 *
10 cb41dd63 Renato Botelho
 *	Some or all of this file is based on the m0n0wall project which is
11
 *	Copyright (c)  2004 Manuel Kasper (BSD 2 clause)
12 f74457df Stephen Beaver
 *
13
 *	Redistribution and use in source and binary forms, with or without modification,
14
 *	are permitted provided that the following conditions are met:
15
 *
16
 *	1. Redistributions of source code must retain the above copyright notice,
17
 *		this list of conditions and the following disclaimer.
18
 *
19
 *	2. Redistributions in binary form must reproduce the above copyright
20
 *		notice, this list of conditions and the following disclaimer in
21
 *		the documentation and/or other materials provided with the
22
 *		distribution.
23
 *
24
 *	3. All advertising materials mentioning features or use of this software
25
 *		must display the following acknowledgment:
26
 *		"This product includes software developed by the pfSense Project
27
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
28
 *
29
 *	4. The names "pfSense" and "pfSense Project" must not be used to
30
 *		 endorse or promote products derived from this software without
31
 *		 prior written permission. For written permission, please contact
32
 *		 coreteam@pfsense.org.
33
 *
34
 *	5. Products derived from this software may not be called "pfSense"
35
 *		nor may "pfSense" appear in their names without prior written
36
 *		permission of the Electric Sheep Fencing, LLC.
37
 *
38
 *	6. Redistributions of any form whatsoever must retain the following
39
 *		acknowledgment:
40
 *
41
 *	"This product includes software developed by the pfSense Project
42
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
43
 *
44
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
45
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
47
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
48
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
49
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
53
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
55
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
56
 *
57
 *	====================================================================
58
 *
59
 */
60 fab7ff44 Bill Marquette
61 6b07c15a Matthew Grooms
##|+PRIV
62
##|*IDENT=page-system-groupmanager
63 5230f468 jim-p
##|*NAME=System: Group manager
64 6b07c15a Matthew Grooms
##|*DESCR=Allow access to the 'System: Group manager' page.
65
##|*MATCH=system_groupmanager.php*
66
##|-PRIV
67 fab7ff44 Bill Marquette
68 3fa86ecd sullrich
require("guiconfig.inc");
69 d88c6a9f Scott Ullrich
70 461487c2 Phil Davis
$pgtitle = array(gettext("System"), gettext("User Manager"), gettext("Groups"));
71 fab7ff44 Bill Marquette
72 e0c7b2fe Phil Davis
if (!is_array($config['system']['group'])) {
73 6b07c15a Matthew Grooms
	$config['system']['group'] = array();
74 e0c7b2fe Phil Davis
}
75 d81c2ad1 Scott Ullrich
76 6b07c15a Matthew Grooms
$a_group = &$config['system']['group'];
77 d81c2ad1 Scott Ullrich
78 7ea27b0d Renato Botelho
unset($id);
79 e0c7b2fe Phil Davis
if (isset($_POST['groupid']) && is_numericint($_POST['groupid'])) {
80 7ea27b0d Renato Botelho
	$id = $_POST['groupid'];
81 e0c7b2fe Phil Davis
}
82 d81c2ad1 Scott Ullrich
83 2f1e91e4 Stephen Beaver
if (isset($_GET['groupid']) && is_numericint($_GET['groupid'])) {
84
	$id = $_GET['groupid'];
85
}
86
87
$act = (isset($_GET['act']) ? $_GET['act'] : '');
88 31b53653 Scott Ullrich
89 7ea27b0d Renato Botelho
if ($act == "delgroup") {
90
91 2f1e91e4 Stephen Beaver
	if (!isset($id) || !isset($_GET['groupname']) || !isset($a_group[$id]) || ($_GET['groupname'] != $a_group[$id]['name'])) {
92 6b07c15a Matthew Grooms
		pfSenseHeader("system_groupmanager.php");
93
		exit;
94
	}
95 31b53653 Scott Ullrich
96 920dbb26 Renato Botelho
	conf_mount_rw();
97 7ea27b0d Renato Botelho
	local_group_del($a_group[$id]);
98 920dbb26 Renato Botelho
	conf_mount_ro();
99 7ea27b0d Renato Botelho
	$groupdeleted = $a_group[$id]['name'];
100
	unset($a_group[$id]);
101 6b07c15a Matthew Grooms
	write_config();
102 8545adde k-paulius
	$savemsg = sprintf(gettext("Group %s successfully deleted."), $groupdeleted);
103 fab7ff44 Bill Marquette
}
104 d88c6a9f Scott Ullrich
105 7ea27b0d Renato Botelho
if ($act == "delpriv") {
106 6b07c15a Matthew Grooms
107 7ea27b0d Renato Botelho
	if (!isset($id) || !isset($a_group[$id])) {
108 6b07c15a Matthew Grooms
		pfSenseHeader("system_groupmanager.php");
109
		exit;
110
	}
111 fab7ff44 Bill Marquette
112 7ea27b0d Renato Botelho
	$privdeleted = $priv_list[$a_group[$id]['priv'][$_POST['privid']]]['name'];
113 2f1e91e4 Stephen Beaver
	unset($a_group[$id]['priv'][$_GET['privid']]);
114 6b07c15a Matthew Grooms
115 2ee08031 Erik Fonnesbeck
	if (is_array($a_group[$id]['member'])) {
116
		foreach ($a_group[$id]['member'] as $uid) {
117
			$user = getUserEntryByUID($uid);
118 e0c7b2fe Phil Davis
			if ($user) {
119 2ee08031 Erik Fonnesbeck
				local_user_set($user);
120 64600f94 Sjon Hortensius
			}
121 2ee08031 Erik Fonnesbeck
		}
122 64600f94 Sjon Hortensius
	}
123 45ee90ed Matthew Grooms
124 6b07c15a Matthew Grooms
	write_config();
125 7ea27b0d Renato Botelho
	$act = "edit";
126 8545adde k-paulius
	$savemsg = sprintf(gettext("Privilege %s successfully deleted."), $privdeleted);
127 6b07c15a Matthew Grooms
}
128 45ee90ed Matthew Grooms
129 7ea27b0d Renato Botelho
if ($act == "edit") {
130
	if (isset($id) && isset($a_group[$id])) {
131 45ee90ed Matthew Grooms
		$pconfig['name'] = $a_group[$id]['name'];
132 6b07c15a Matthew Grooms
		$pconfig['gid'] = $a_group[$id]['gid'];
133
		$pconfig['gtype'] = $a_group[$id]['scope'];
134 45ee90ed Matthew Grooms
		$pconfig['description'] = $a_group[$id]['description'];
135 6b07c15a Matthew Grooms
		$pconfig['members'] = $a_group[$id]['member'];
136
		$pconfig['priv'] = $a_group[$id]['priv'];
137 45ee90ed Matthew Grooms
	}
138
}
139 6b07c15a Matthew Grooms
140 2f1e91e4 Stephen Beaver
if (isset($_GET['dellall_x'])) {
141 c0c5b8cc bruno
142 2f1e91e4 Stephen Beaver
	$del_groups = $_GET['delete_check'];
143 c0c5b8cc bruno
144 e0c7b2fe Phil Davis
	if (!empty($del_groups)) {
145
		foreach ($del_groups as $groupid) {
146
			if (isset($a_group[$groupid]) && $a_group[$groupid]['scope'] != "system") {
147 c0c5b8cc bruno
				conf_mount_rw();
148
				local_group_del($a_group[$groupid]);
149
				conf_mount_ro();
150
				unset($a_group[$groupid]);
151
			}
152
		}
153 8545adde k-paulius
		$savemsg = gettext("Selected groups removed successfully.");
154 c0c5b8cc bruno
		write_config($savemsg);
155
	}
156
}
157
158 7ea27b0d Renato Botelho
if (isset($_POST['save'])) {
159 d88c6a9f Scott Ullrich
	unset($input_errors);
160
	$pconfig = $_POST;
161
162
	/* input validation */
163
	$reqdfields = explode(" ", "groupname");
164 b4fd804b Carlos Eduardo Ramos
	$reqdfieldsn = array(gettext("Group Name"));
165 4c291f4c Renato Botelho
166 1e9b4611 Renato Botelho
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
167 4c291f4c Renato Botelho
168 e0c7b2fe Phil Davis
	if (preg_match("/[^a-zA-Z0-9\.\-_ ]/", $_POST['groupname'])) {
169 bbf825ab Vinicius Coque
		$input_errors[] = gettext("The group name contains invalid characters.");
170 e0c7b2fe Phil Davis
	}
171 4c291f4c Renato Botelho
172 e0c7b2fe Phil Davis
	if (strlen($_POST['groupname']) > 16) {
173 3db408b3 PiBa-NL
		$input_errors[] = gettext("The group name is longer than 16 characters.");
174 e0c7b2fe Phil Davis
	}
175 4c291f4c Renato Botelho
176 d88c6a9f Scott Ullrich
	if (!$input_errors && !(isset($id) && $a_group[$id])) {
177
		/* make sure there are no dupes */
178
		foreach ($a_group as $group) {
179
			if ($group['name'] == $_POST['groupname']) {
180 bbf825ab Vinicius Coque
				$input_errors[] = gettext("Another entry with the same group name already exists.");
181 d88c6a9f Scott Ullrich
				break;
182
			}
183
		}
184
	}
185 4c291f4c Renato Botelho
186 d88c6a9f Scott Ullrich
	if (!$input_errors) {
187 45ee90ed Matthew Grooms
		$group = array();
188 e0c7b2fe Phil Davis
		if (isset($id) && $a_group[$id]) {
189 d88c6a9f Scott Ullrich
			$group = $a_group[$id];
190 e0c7b2fe Phil Davis
		}
191 4c291f4c Renato Botelho
192 d88c6a9f Scott Ullrich
		$group['name'] = $_POST['groupname'];
193
		$group['description'] = $_POST['description'];
194 45ee90ed Matthew Grooms
195 e0c7b2fe Phil Davis
		if (empty($_POST['members'])) {
196 70d6b5c4 Ermal
			unset($group['member']);
197 e0c7b2fe Phil Davis
		} else if ($group['gid'] != 1998) { // all group
198 6b07c15a Matthew Grooms
			$group['member'] = $_POST['members'];
199 e0c7b2fe Phil Davis
		}
200 45ee90ed Matthew Grooms
201 e0c7b2fe Phil Davis
		if (isset($id) && $a_group[$id]) {
202 d88c6a9f Scott Ullrich
			$a_group[$id] = $group;
203 e0c7b2fe Phil Davis
		} else {
204 45ee90ed Matthew Grooms
			$group['gid'] = $config['system']['nextgid']++;
205 d88c6a9f Scott Ullrich
			$a_group[] = $group;
206 45ee90ed Matthew Grooms
		}
207
208 920dbb26 Renato Botelho
		conf_mount_rw();
209 659fa7f2 Matthew Grooms
		local_group_set($group);
210 920dbb26 Renato Botelho
		conf_mount_ro();
211 2a0e8512 jim-p
212
		/* Refresh users in this group since their privileges may have changed. */
213 5709072a jim-p
		if (is_array($group['member'])) {
214
			$a_user = &$config['system']['user'];
215
			foreach ($a_user as & $user) {
216 e0c7b2fe Phil Davis
				if (in_array($user['uid'], $group['member'])) {
217 5709072a jim-p
					local_user_set($user);
218 e0c7b2fe Phil Davis
				}
219 5709072a jim-p
			}
220 2a0e8512 jim-p
		}
221
222 d88c6a9f Scott Ullrich
		write_config();
223 4c291f4c Renato Botelho
224 d88c6a9f Scott Ullrich
		header("Location: system_groupmanager.php");
225
		exit;
226
	}
227 fab7ff44 Bill Marquette
}
228
229 2f1e91e4 Stephen Beaver
function build_priv_table() {
230
	global $a_group, $id;
231
232
	$privhtml = '<div class="table-responsive">';
233
	$privhtml .=	'<table class="table table-striped table-hover table-condensed">';
234
	$privhtml .=		'<thead>';
235
	$privhtml .=			'<th>' . gettext('Name') . '</th>';
236
	$privhtml .=			'<th>' . gettext('Description') . '</th>';
237
	$privhtml .=		'</thead>';
238
	$privhtml .=		'<tbody>';
239
240
	foreach (get_user_privdesc($a_group[$id]) as $i => $priv) {
241
		$privhtml .=		'<tr>';
242
		$privhtml .=			'<td>' . htmlspecialchars($priv['name']) . '</td>';
243
		$privhtml .=			'<td>' . htmlspecialchars($priv['descr']) . '</td>';
244 ed10e389 Phil Davis
		$privhtml .=			'<td><a class="fa fa-trash" title="' . gettext('Delete Privilege') . '"	href="system_groupmanager.php?act=delpriv&amp;groupid=' . $id . '&amp;privid=' . $i . '"></a></td>';
245 2f1e91e4 Stephen Beaver
		$privhtml .=		'</tr>';
246 d61309a0 Phil Davis
247 2f1e91e4 Stephen Beaver
	}
248
249
	$privhtml .=		'</tbody>';
250
	$privhtml .=	'</table>';
251
	$privhtml .= '</div>';
252
253
	$privhtml .= '<nav class="action-buttons">';
254
	$privhtml .=	'<a href="system_groupmanager_addprivs.php?groupid=' . $id . '" class="btn btn-success">' . gettext("Add") . '</a>';
255
	$privhtml .= '</nav>';
256
257
	return($privhtml);
258
}
259
260 fab7ff44 Bill Marquette
include("head.inc");
261
262 d61309a0 Phil Davis
if ($input_errors) {
263 64600f94 Sjon Hortensius
	print_input_errors($input_errors);
264 d61309a0 Phil Davis
}
265
if ($savemsg) {
266 f78bbe16 Phil Davis
	print_info_box($savemsg, 'success');
267 d61309a0 Phil Davis
}
268 64600f94 Sjon Hortensius
269
$tab_array = array();
270
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
271
$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
272
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
273 2d1f33d9 k-paulius
$tab_array[] = array(gettext("Authentication Servers"), false, "system_authservers.php");
274 64600f94 Sjon Hortensius
display_top_tabs($tab_array);
275
276 d61309a0 Phil Davis
if (!($_GET['act'] == "new" || $_GET['act'] == "edit")) {
277 64600f94 Sjon Hortensius
?>
278 060ed238 Stephen Beaver
<div class="panel panel-default">
279
	<div class="panel-heading"><h2 class="panel-title"><?=gettext('Groups')?></h2></div>
280
	<div class="panel-body">
281
		<div class="table-responsive">
282
			<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
283
				<thead>
284
					<tr>
285
						<th><?=gettext("Group name")?></th>
286
						<th><?=gettext("Description")?></th>
287
						<th><?=gettext("Member Count")?></th>
288
						<th><?=gettext("Actions")?></th>
289
					</tr>
290
				</thead>
291
				<tbody>
292 64600f94 Sjon Hortensius
<?php
293 d61309a0 Phil Davis
	foreach ($a_group as $i => $group):
294
		if ($group["name"] == "all") {
295 64600f94 Sjon Hortensius
			$groupcount = count($config['system']['user']);
296 d61309a0 Phil Davis
		} else {
297 64600f94 Sjon Hortensius
			$groupcount = count($group['member']);
298 d61309a0 Phil Davis
		}
299 64600f94 Sjon Hortensius
?>
300 060ed238 Stephen Beaver
					<tr>
301
						<td>
302
							<?=htmlspecialchars($group['name'])?>
303
						</td>
304
						<td>
305
							<?=htmlspecialchars($group['description'])?>
306
						</td>
307
						<td>
308
							<?=$groupcount?>
309
						</td>
310
						<td>
311
							<a class="fa fa-pencil" title="<?=gettext("Edit group"); ?>" href="?act=edit&amp;groupid=<?=$i?>"></a>
312
							<?php if ($group['scope'] != "system"): ?>
313
								<a class="fa fa-trash"	title="<?=gettext("Delete group")?>" href="?act=delgroup&amp;groupid=<?=$i?>&amp;groupname=<?=$group['name']?>"></a>
314
							<?php endif;?>
315
						</td>
316
					</tr>
317 64600f94 Sjon Hortensius
<?php
318
	endforeach;
319 fab7ff44 Bill Marquette
?>
320 060ed238 Stephen Beaver
				</tbody>
321
			</table>
322
		</div>
323 94404d94 Sander van Leeuwen
	</div>
324 060ed238 Stephen Beaver
</div>
325
326
<nav class="action-buttons">
327
	<a href="?act=new" class="btn btn-success btn-sm">
328
		<i class="fa fa-plus icon-embed-btn"></i>
329
		<?=gettext("Add")?>
330
	</a>
331
</nav>
332 64600f94 Sjon Hortensius
<?php
333
	include('foot.inc');
334
	exit;
335 6b07c15a Matthew Grooms
}
336
337 64600f94 Sjon Hortensius
$form = new Form;
338
$form->setAction('system_groupmanager.php?act=edit');
339
$form->addGlobal(new Form_Input(
340
	'groupid',
341
	null,
342
	'hidden',
343
	$id
344
));
345
346
if (isset($id) && $a_group[$id]){
347
	$form->addGlobal(new Form_Input(
348
		'id',
349
		null,
350
		'hidden',
351
		$id
352
	));
353
354
	$form->addGlobal(new Form_Input(
355
		'gid',
356
		null,
357
		'hidden',
358
		$pconfig['gid']
359
	));
360 61dec0b0 Renato Botelho
}
361
362 5f88f964 k-paulius
$section = new Form_Section('Group Properties');
363 64600f94 Sjon Hortensius
364 d61309a0 Phil Davis
if ($_GET['act'] != "new") {
365 64600f94 Sjon Hortensius
	$section->addInput(new Form_StaticText(
366
		'Defined by',
367
		strtoupper($pconfig['gtype'])
368
	));
369 6b07c15a Matthew Grooms
}
370
371 e6acc2ee Sjon Hortensius
$section->addInput($input = new Form_Input(
372 64600f94 Sjon Hortensius
	'groupname',
373
	'Group name',
374
	'text',
375
	$pconfig['name']
376
));
377
378 d61309a0 Phil Davis
if ($pconfig['gtype'] == "system") {
379 1192840b Sjon Hortensius
	$input->setReadonly();
380 d61309a0 Phil Davis
}
381 e6acc2ee Sjon Hortensius
382 64600f94 Sjon Hortensius
$section->addInput(new Form_Input(
383
	'description',
384
	'Description',
385
	'text',
386
	$pconfig['description']
387
))->setHelp('Group description, for your own information only');
388
389
$form->add($section);
390 d61309a0 Phil Davis
if ($pconfig['gid'] != 1998) { // all users group
391
392 2f1e91e4 Stephen Beaver
	// ==== Group membership ==================================================
393
	$group = new Form_Group('Group membership');
394
395
	// Make a list of all the groups configured on the system, and a list of
396
	// those which this user is a member of
397
	$systemGroups = array();
398
	$usersGroups = array();
399
400
	foreach ($config['system']['user'] as $user) {
401 d61309a0 Phil Davis
		if (is_array($pconfig['members']) && in_array($user['uid'], $pconfig['members'])) {
402 2f1e91e4 Stephen Beaver
			$usersGroups[ $user['uid'] ] = $user['name'];	// Add it to the user's list
403 d61309a0 Phil Davis
		} else {
404 2f1e91e4 Stephen Beaver
			$systemGroups[ $user['uid'] ] = $user['name']; // Add it to the 'not a member of' list
405 d61309a0 Phil Davis
		}
406 2f1e91e4 Stephen Beaver
	}
407
408
	$group->add(new Form_Select(
409
		'notmembers',
410
		null,
411
		array_combine((array)$pconfig['groups'], (array)$pconfig['groups']),
412
		$systemGroups,
413
		true
414 6ef8f2e9 heper
	))->setHelp('Not members');
415 64600f94 Sjon Hortensius
416 2f1e91e4 Stephen Beaver
	$group->add(new Form_Select(
417 64600f94 Sjon Hortensius
		'members',
418 2f1e91e4 Stephen Beaver
		null,
419
		array_combine((array)$pconfig['groups'], (array)$pconfig['groups']),
420
		$usersGroups,
421 64600f94 Sjon Hortensius
		true
422 6ef8f2e9 heper
	))->setHelp('Members');
423 2f1e91e4 Stephen Beaver
424
	$section->add($group);
425
426
	$group = new Form_Group('');
427
428
	$group->add(new Form_Button(
429
		'movetoenabled',
430
		'Move to "Members" >'
431
	))->removeClass('btn-primary')->addClass('btn-default btn-sm');
432
433
	$group->add(new Form_Button(
434
		'movetodisabled',
435
		'< Move to "Not members'
436
	))->removeClass('btn-primary')->addClass('btn-default btn-sm');
437
438
	$group->setHelp('Hold down CTRL (pc)/COMMAND (mac) key to select multiple items');
439
	$section->add($group);
440 64600f94 Sjon Hortensius
441 6b07c15a Matthew Grooms
}
442
443 d61309a0 Phil Davis
if ($_GET['act'] != "new") {
444 64600f94 Sjon Hortensius
	$section = new Form_Section('Assigned Privileges');
445
446
	$section->addInput(new Form_StaticText(
447
		null,
448 2f1e91e4 Stephen Beaver
		build_priv_table()
449 64600f94 Sjon Hortensius
	));
450 6b07c15a Matthew Grooms
451 2f1e91e4 Stephen Beaver
452 64600f94 Sjon Hortensius
	$form->add($section);
453 6b07c15a Matthew Grooms
}
454
455 64600f94 Sjon Hortensius
print $form;
456 2f1e91e4 Stephen Beaver
?>
457 8fd9052f Colin Fleming
<script type="text/javascript">
458 2f1e91e4 Stephen Beaver
//<![CDATA[
459 d61309a0 Phil Davis
events.push(function() {
460 2f1e91e4 Stephen Beaver
461
	// Select every option in the specified multiselect
462
	function AllServers(id, selectAll) {
463
	   for (i = 0; i < id.length; i++)	   {
464
		   id.eq(i).prop('selected', selectAll);
465
	   }
466
	}
467 e30001cf Matthew Grooms
468 2f1e91e4 Stephen Beaver
	// Move all selected options from one multiselect to another
469
	function moveOptions(From, To)	{
470
		var len = From.length;
471
		var option, value;
472
473 d61309a0 Phil Davis
		if (len > 1) {
474
			for (i=0; i<len; i++) {
475
				if (From.eq(i).is(':selected')) {
476 2f1e91e4 Stephen Beaver
					option = From.eq(i).val();
477
					value = From.eq(i).text();
478
					To.append(new Option(value, option));
479
					From.eq(i).remove();
480
				}
481
			}
482
		}
483
	}
484
485
	// Make buttons plain buttons, not submit
486
	$("#movetodisabled").prop('type','button');
487
	$("#movetoenabled").prop('type','button');
488
489
490
	// On click . .
491
	$("#movetodisabled").click(function() {
492
		moveOptions($('[name="members[]"] option'), $('[name="notmembers[]"]'));
493
	});
494
495
	$("#movetoenabled").click(function() {
496
		moveOptions($('[name="notmembers[]"] option'), $('[name="members[]"]'));
497
	});
498
499
	// On submit mark all the user's groups as "selected"
500 d61309a0 Phil Davis
	$('form').submit(function() {
501 2f1e91e4 Stephen Beaver
		AllServers($('[name="members[]"] option'), true);
502
	});
503
});
504
//]]>
505
</script>
506
<?php
507 854fa106 heper
include('foot.inc');