Project

General

Profile

« Previous | Next » 

Revision e6407b22

Added by Viktor Gurov almost 4 years ago

Group copy button. Implements #12226

View differences:

src/usr/local/www/system_groupmanager.php
48 48
$id = $_REQUEST['groupid'];
49 49
$act = (isset($_REQUEST['act']) ? $_REQUEST['act'] : '');
50 50

  
51
if ($act == 'dup') {
52
	$dup = true;
53
	$act = 'edit';
54
}
55

  
51 56
function cpusercmp($a, $b) {
52 57
	return strcasecmp($a['name'], $b['name']);
53 58
}
......
130 135

  
131 136
if ($act == "edit") {
132 137
	if (isset($id) && isset($a_group[$id])) {
133
		$pconfig['name'] = $a_group[$id]['name'];
134
		$pconfig['gid'] = $a_group[$id]['gid'];
135
		$pconfig['gtype'] = empty($a_group[$id]['scope'])
136
		    ? "local" : $a_group[$id]['scope'];
138
		if (!$dup) {
139
			$pconfig['name'] = $a_group[$id]['name'];
140
			$pconfig['gid'] = $a_group[$id]['gid'];
141
			$pconfig['gtype'] = empty($a_group[$id]['scope'])
142
			    ? "local" : $a_group[$id]['scope'];
143
		} else {
144
			$pconfig['gtype'] = ($a_group[$id]['scope'] == 'system')
145
			    ? "local" : $a_group[$id]['scope'];
146
		}
137 147
		$pconfig['description'] = $a_group[$id]['description'];
138 148
		$pconfig['members'] = $a_group[$id]['member'];
139 149
		$pconfig['priv'] = $a_group[$id]['priv'];
......
173 183
	unset($input_errors);
174 184
	$pconfig = $_POST;
175 185

  
186
	if ($dup) {
187
		unset($id);
188
	}
189

  
176 190
	/* input validation */
177 191
	$reqdfields = explode(" ", "groupname");
178 192
	$reqdfieldsn = array(gettext("Group Name"));
......
401 415
						</td>
402 416
						<td>
403 417
							<a class="fa fa-pencil" title="<?=gettext("Edit group"); ?>" href="?act=edit&amp;groupid=<?=$i?>"></a>
418
							<a class="fa fa-clone" title="<?=gettext("Copy group"); ?>" href="?act=dup&amp;groupid=<?=$i?>"></a>
404 419
							<?php if (($group['scope'] != "system") && !$read_only): ?>
405 420
								<a class="fa fa-trash"	title="<?=gettext("Delete group")?>" href="?act=delgroup&amp;groupid=<?=$i?>&amp;groupname=<?=$group['name']?>" usepost></a>
406 421
							<?php endif;?>
......
558 573

  
559 574
}
560 575

  
561
if (isset($pconfig['gid'])) {
576
if (isset($pconfig['gid']) || $dup) {
562 577
	$section = new Form_Section('Assigned Privileges');
563 578

  
564 579
	$section->addInput(new Form_StaticText(

Also available in: Unified diff