Project

General

Profile

« Previous | Next » 

Revision 9270d777

Added by Jim Pingle almost 2 years ago

Improve dup action tests in group mgr. Fixes #14695

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
$dup = null;
52

  
51 53
if ($act == 'dup') {
52 54
	$dup = $id;
53 55
	$act = 'edit';
......
105 107
	syslog($logging_level, "{$logging_prefix}: {$savemsg}");
106 108
}
107 109

  
108
if (($_POST['act'] == "delpriv") && !$read_only && !$dup) {
110
if (($_POST['act'] == "delpriv") && !$read_only && ($dup === null)) {
109 111

  
110 112
	if (!isset($id) || !isset($a_group[$id])) {
111 113
		pfSenseHeader("system_groupmanager.php");
......
135 137

  
136 138
if ($act == "edit") {
137 139
	if (isset($id) && isset($a_group[$id])) {
138
		if (!$dup) {
140
		if ($dup === null) {
139 141
			$pconfig['name'] = $a_group[$id]['name'];
140 142
			$pconfig['gid'] = $a_group[$id]['gid'];
141 143
			$pconfig['gtype'] = empty($a_group[$id]['scope'])
......
316 318
			$user_has_root_priv = true;
317 319
		}
318 320
		$privhtml .=			'</td>';
319
		if (!$read_only && !$dup) {
321
		if (!$read_only && ($dup === null)) {
320 322
			$privhtml .=			'<td><a class="fa fa-trash" title="' . gettext('Delete Privilege') . '"	href="system_groupmanager.php?act=delpriv&amp;groupid=' . $id . '&amp;privid=' . $i . '" usepost></a></td>';
321 323
		}
322 324
		$privhtml .=		'</tr>';
......
339 341
	$privhtml .= '</div>';
340 342

  
341 343
	$privhtml .= '<nav class="action-buttons">';
342
	if (!$read_only && !$dup) {
344
	if (!$read_only && ($dup === null)) {
343 345
		$privhtml .=	'<a href="system_groupmanager_addprivs.php?groupid=' . $id . '" class="btn btn-success"><i class="fa fa-plus icon-embed-btn"></i>' . gettext("Add") . '</a>';
344 346
	}
345 347
	$privhtml .= '</nav>';
......
444 446

  
445 447
$form = new Form;
446 448
$form->setAction('system_groupmanager.php?act=edit');
447
if (!$dup) {
449
if ($dup === null) {
448 450
	$form->addGlobal(new Form_Input(
449 451
		'groupid',
450 452
		null,
......
581 583

  
582 584
}
583 585

  
584
if (isset($pconfig['gid']) || $dup) {
586
if (isset($pconfig['gid']) || ($dup !== null)) {
585 587
	$section = new Form_Section('Assigned Privileges');
586 588

  
587 589
	$section->addInput(new Form_StaticText(

Also available in: Unified diff