Concider Access level for item filtering

This commit is contained in:
Lord-Grey 2021-05-21 20:21:43 +02:00
parent 332655abfb
commit 5b0ce3c0f2
2 changed files with 20 additions and 13 deletions

View File

@ -277,13 +277,13 @@ $(document).ready(function () {
fps = parseInt(framerates); fps = parseInt(framerates);
} }
//Show Frameskipping only when more than 2 fps ////Show Frameskipping only when more than 2 fps
if (fps > 2 && storedAccess === "expert") { //if (fps > 2) {
showInputOptions("framegrabber", ["fpsSoftwareDecimation"], true); // showInputOptionForItem(conf_editor_screen, "framegrabber", "fpsSoftwareDecimation", true);
} //}
else { //else {
showInputOptions("framegrabber", ["fpsSoftwareDecimation"], false); // showInputOptionForItem(conf_editor_screen, "framegrabber", "fpsSoftwareDecimation", false);
} //}
conf_editor_screen.getEditor("root.framegrabber.fps").setValue(fps); conf_editor_screen.getEditor("root.framegrabber.fps").setValue(fps);
}); });
@ -317,9 +317,9 @@ $(document).ready(function () {
true); true);
if (jQuery.isEmptyObject(properties)) { if (jQuery.isEmptyObject(properties)) {
showInputOptions("grabberV4L2", [key], false); showInputOptionForItem(conf_editor_video, "grabberV4L2", key, false);
} else { } else {
showInputOptions("grabberV4L2", [key], true); showInputOptionForItem(conf_editor_video, "grabberV4L2", key, true);
} }
} }
@ -620,13 +620,12 @@ $(document).ready(function () {
if (framerates !== "NONE") { if (framerates !== "NONE") {
fps = parseInt(framerates); fps = parseInt(framerates);
} }
//Show Frameskipping only when more than 2 fps //Show Frameskipping only when more than 2 fps
if (fps > 2 && storedAccess === "expert") { if (fps > 2) {
showInputOptions("grabberV4L2", ["fpsSoftwareDecimation"], true); showInputOptionForItem(conf_editor_video, "grabberV4L2", "fpsSoftwareDecimation", true);
} }
else { else {
showInputOptions("grabberV4L2", ["fpsSoftwareDecimation"], false); showInputOptionForItem(conf_editor_video, "grabberV4L2", "fpsSoftwareDecimation", false);
} }
conf_editor_video.getEditor("root.grabberV4L2.fps").setValue(fps); conf_editor_video.getEditor("root.grabberV4L2.fps").setValue(fps);
}); });

View File

@ -1155,6 +1155,14 @@ function showInputOptions(path, elements, state) {
} }
} }
function showInputOptionForItem(editor, path, item, state) {
var accessLevel = editor.schema.properties[path].properties[item].access;
// Enable element only, if access level compliant
if (!state || isAccessLevelCompliant(accessLevel)) {
showInputOptions(path, [item], state);
}
}
function showInputOptionsForKey(editor, item, showForKeys, state) { function showInputOptionsForKey(editor, item, showForKeys, state) {
var elements = []; var elements = [];
var keysToshow = []; var keysToshow = [];