Revision 5d916fc7
Added by Stephen Beaver over 9 years ago
src/etc/inc/priv.defs.inc | ||
---|---|---|
43 | 43 |
$priv_list['page-diagnostics-authentication']['match'] = array(); |
44 | 44 |
$priv_list['page-diagnostics-authentication']['match'][] = "diag_authentication.php*"; |
45 | 45 |
|
46 |
$priv_list['page-diagnostics-backup/restore'] = array();
|
|
47 |
$priv_list['page-diagnostics-backup/restore']['name'] = gettext("WebCfg - Diagnostics: Backup/restore");
|
|
48 |
$priv_list['page-diagnostics-backup/restore']['descr'] = gettext("Allow access to the 'Diagnostics: Backup/restore' page.");
|
|
49 |
$priv_list['page-diagnostics-backup/restore']['match'] = array();
|
|
50 |
$priv_list['page-diagnostics-backup/restore']['match'][] = "diag_backup.php*";
|
|
46 |
$priv_list['page-diagnostics-backup-restore'] = array();
|
|
47 |
$priv_list['page-diagnostics-backup-restore']['name'] = gettext("WebCfg - Diagnostics: Backup/restore");
|
|
48 |
$priv_list['page-diagnostics-backup-restore']['descr'] = gettext("Allow access to the 'Diagnostics: Backup/restore' page.");
|
|
49 |
$priv_list['page-diagnostics-backup-restore']['match'] = array();
|
|
50 |
$priv_list['page-diagnostics-backup-restore']['match'][] = "diag_backup.php*";
|
|
51 | 51 |
|
52 | 52 |
$priv_list['page-diagnostics-configurationhistory'] = array(); |
53 | 53 |
$priv_list['page-diagnostics-configurationhistory']['name'] = gettext("WebCfg - Diagnostics: Configuration History"); |
... | ... | |
430 | 430 |
$priv_list['page-xmlrpcinterfacestats']['match'] = array(); |
431 | 431 |
$priv_list['page-xmlrpcinterfacestats']['match'][] = "ifstats.php*"; |
432 | 432 |
|
433 |
$priv_list['page-system-login/logout'] = array();
|
|
434 |
$priv_list['page-system-login/logout']['name'] = gettext("WebCfg - System: Login / Logout / Dashboard");
|
|
435 |
$priv_list['page-system-login/logout']['descr'] = gettext("Allow access to the 'System: Login / Logout' page and Dashboard.");
|
|
436 |
$priv_list['page-system-login/logout']['match'] = array();
|
|
437 |
$priv_list['page-system-login/logout']['match'][] = "index.php*";
|
|
433 |
$priv_list['page-system-login-logout'] = array();
|
|
434 |
$priv_list['page-system-login-logout']['name'] = gettext("WebCfg - System: Login / Logout / Dashboard");
|
|
435 |
$priv_list['page-system-login-logout']['descr'] = gettext("Allow access to the 'System: Login / Logout' page and Dashboard.");
|
|
436 |
$priv_list['page-system-login-logout']['match'] = array();
|
|
437 |
$priv_list['page-system-login-logout']['match'][] = "index.php*";
|
|
438 | 438 |
|
439 | 439 |
$priv_list['page-interfaces'] = array(); |
440 | 440 |
$priv_list['page-interfaces']['name'] = gettext("WebCfg - Interfaces: WAN"); |
src/etc/inc/priv.inc | ||
---|---|---|
338 | 338 |
|
339 | 339 |
function sort_user_privs($privs) { |
340 | 340 |
// Privileges to place first, to redirect properly. |
341 |
$priority_privs = array("page-dashboard-all", "page-system-login/logout");
|
|
341 |
$priority_privs = array("page-dashboard-all", "page-system-login-logout");
|
|
342 | 342 |
|
343 | 343 |
$fprivs = array_intersect($privs, $priority_privs); |
344 | 344 |
$sprivs = array_diff($privs, $priority_privs); |
src/usr/local/www/diag_backup.php | ||
---|---|---|
57 | 57 |
*/ |
58 | 58 |
|
59 | 59 |
##|+PRIV |
60 |
##|*IDENT=page-diagnostics-backup/restore
|
|
60 |
##|*IDENT=page-diagnostics-backup-restore
|
|
61 | 61 |
##|*NAME=Diagnostics: Backup/restore |
62 | 62 |
##|*DESCR=Allow access to the 'Diagnostics: Backup/restore' page. |
63 | 63 |
##|*MATCH=diag_backup.php* |
src/usr/local/www/index.php | ||
---|---|---|
57 | 57 |
*/ |
58 | 58 |
|
59 | 59 |
##|+PRIV |
60 |
##|*IDENT=page-system-login/logout
|
|
60 |
##|*IDENT=page-system-login-logout
|
|
61 | 61 |
##|*NAME=System: Login / Logout / Dashboard |
62 | 62 |
##|*DESCR=Allow access to the 'System: Login / Logout' page and Dashboard. |
63 | 63 |
##|*MATCH=index.php* |
src/usr/local/www/system_usermanager_addprivs.php | ||
---|---|---|
93 | 93 |
uasort($spriv_list, admusercmp); |
94 | 94 |
|
95 | 95 |
if ($_POST) { |
96 |
|
|
96 | 97 |
conf_mount_rw(); |
97 | 98 |
|
98 | 99 |
unset($input_errors); |
... | ... | |
186 | 187 |
true |
187 | 188 |
))->addClass('multiselect') |
188 | 189 |
->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items'); |
189 |
// ->setAttribute('style', 'height:400px;'); |
|
190 | 190 |
|
191 |
$section->addInput(new Form_Select( |
|
192 |
'shadow', |
|
193 |
'Shadow', |
|
194 |
null, |
|
195 |
build_priv_list(), |
|
196 |
true |
|
197 |
))->addClass('shadowselect') |
|
198 |
->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items'); |
|
191 | 199 |
|
192 | 200 |
$section->addInput(new Form_Input( |
193 | 201 |
'filtertxt', |
... | ... | |
240 | 248 |
|
241 | 249 |
<?php |
242 | 250 |
|
251 |
|
|
243 | 252 |
// Build a list of privilege descriptions |
244 | 253 |
if (is_array($spriv_list)) { |
245 | 254 |
$id = 0; |
... | ... | |
257 | 266 |
echo $jdescs; |
258 | 267 |
} |
259 | 268 |
?> |
269 |
|
|
270 |
$('.shadowselect').hide(); |
|
271 |
|
|
260 | 272 |
// Set the number of options to display |
261 | 273 |
$('.multiselect').attr("size","20"); |
274 |
$('.shadowselect').attr("size","20"); |
|
262 | 275 |
|
263 | 276 |
// When the 'sysprivs" selector is clicked, we display a description |
264 | 277 |
$('.multiselect').click(function() { |
265 | 278 |
$('#pdesc').html('<span class="text-info">' + descs[$(this).children('option:selected').index()] + '</span>'); |
279 |
|
|
280 |
// and update the shadow list from the real list |
|
281 |
$(".multiselect option").each(function() { |
|
282 |
shadowoption = $('.shadowselect option').filter('[value=' + $(this).val() + ']'); |
|
283 |
|
|
284 |
if ($(this).is(':selected')) { |
|
285 |
shadowoption.prop("selected", true); |
|
286 |
} else { |
|
287 |
shadowoption.prop("selected", false); |
|
288 |
} |
|
289 |
}); |
|
266 | 290 |
}); |
267 | 291 |
|
268 | 292 |
$('#btnfilter').prop('type', 'button'); |
269 | 293 |
|
270 | 294 |
$('#btnfilter').click(function() { |
271 | 295 |
searchterm = $('#filtertxt').val().toLowerCase(); |
296 |
copyselect(true); |
|
272 | 297 |
|
298 |
// Then filter |
|
273 | 299 |
$(".multiselect > option").each(function() { |
274 |
if (this.text.toLowerCase().indexOf(searchterm) > -1 ) { |
|
275 |
$(this).show(); |
|
276 |
} else { |
|
277 |
$(this).hide(); |
|
300 |
if (this.text.toLowerCase().indexOf(searchterm) == -1 ) { |
|
301 |
$(this).remove(); |
|
278 | 302 |
} |
279 | 303 |
}); |
280 | 304 |
}); |
... | ... | |
282 | 306 |
$('#btnclear').prop('type', 'button'); |
283 | 307 |
|
284 | 308 |
$('#btnclear').click(function() { |
285 |
$(".multiselect > option").each(function() { |
|
286 |
$(this).show(); |
|
287 |
}); |
|
309 |
// Copy all options from shadow to sysprivs |
|
310 |
copyselect(true) |
|
311 |
|
|
312 |
$('#filtertxt').val(''); |
|
288 | 313 |
}); |
289 | 314 |
|
290 | 315 |
$('#filtertxt').keypress(function(e) { |
... | ... | |
296 | 321 |
|
297 | 322 |
// On submit unhide all options (or else they will not submit) |
298 | 323 |
$('form').submit(function() { |
324 |
|
|
299 | 325 |
$(".multiselect > option").each(function() { |
300 | 326 |
$(this).show(); |
301 | 327 |
}); |
328 |
|
|
329 |
$('.shadowselect').remove(); |
|
330 |
}); |
|
331 |
|
|
332 |
function copyselect(selected) { |
|
333 |
// Copy all optionsfrom shadow to sysprivs |
|
334 |
$('.multiselect').html($('.shadowselect').html()); |
|
335 |
|
|
336 |
if (selected) { |
|
337 |
// Update the shadow list from the real list |
|
338 |
$(".shadowselect option").each(function() { |
|
339 |
multioption = $('.multiselect option').filter('[value=' + $(this).val() + ']'); |
|
340 |
if ($(this).is(':selected')) { |
|
341 |
multioption.prop("selected", true); |
|
342 |
} else { |
|
343 |
multioption.prop("selected", false); |
|
344 |
} |
|
345 |
}); |
|
346 |
} |
|
347 |
} |
|
348 |
|
|
349 |
$('.multiselect').mouseup(function () { |
|
350 |
$('.multiselect').trigger('click'); |
|
302 | 351 |
}); |
303 | 352 |
}); |
304 | 353 |
//]]> |
Also available in: Unified diff
Improvements to the priviledge filter functionality