Project

General

Profile

« Previous | Next » 

Revision df82f650

Added by Phil Davis over 9 years ago

Make group addpriv descriptions work like user addpriv

View differences:

src/usr/local/www/system_groupmanager_addprivs.php
100 100
	$a_group['priv'] = array();
101 101
}
102 102

  
103
// Make a local copy and sort it
104
$spriv_list = $priv_list;
105
uasort($spriv_list, admusercmp);
106

  
103 107
if ($_POST) {
104 108

  
105 109
	unset($input_errors);
......
154 158
}
155 159

  
156 160
function build_priv_list() {
157
	global $priv_list, $a_group;
161
	global $spriv_list, $a_group;
158 162

  
159 163
	$list = array();
160 164

  
161
	foreach ($priv_list as $pname => $pdata) {
165
	foreach ($spriv_list as $pname => $pdata) {
162 166
		if (in_array($pname, $a_group['priv'])) {
163 167
			continue;
164 168
		}
165 169

  
166
		$list[$pname] = $pdata;
170
		$list[$pname] = $pdata['name'];
167 171
	}
168 172

  
169 173
	return($list);
......
198 202

  
199 203
$section = new Form_Section('Add privileges for '. $a_group['name']);
200 204

  
201
$priv_list = array_map(function($p){ return $p['name']; }, $priv_list);
202
asort($priv_list, SORT_STRING|SORT_FLAG_CASE);
203

  
204 205
$section->addInput(new Form_Select(
205 206
	'sysprivs',
206 207
	'Assigned privileges',
......
261 262
<?php
262 263

  
263 264
	// Build a list of privilege descriptions
264
	if (is_array($priv_list)) {
265
	if (is_array($spriv_list)) {
265 266
		$id = 0;
266 267

  
267 268
		$jdescs = "var descs = new Array();\n";
268
		foreach ($priv_list as $pname => $pdata) {
269
		foreach ($spriv_list as $pname => $pdata) {
269 270
			if (in_array($pname, $a_group['priv'])) {
270 271
				continue;
271 272
			}
272 273

  
273
			$desc = addslashes(preg_replace("/pfSense/i", $g['product_name'], $pdata));
274
			$desc = addslashes(preg_replace("/pfSense/i", $g['product_name'], $pdata['descr']));
274 275
			$jdescs .= "descs[{$id}] = '{$desc}';\n";
275 276
			$id++;
276 277
		}

Also available in: Unified diff