mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 21:51:23 +00:00
Prevent accidental addition of cycles.
This commit is contained in:
@@ -1022,9 +1022,22 @@ GuacAdmin.ConnectionGroupEditor = function(group, parameters) {
|
|||||||
document.body.appendChild(group_select.getElement());
|
document.body.appendChild(group_select.getElement());
|
||||||
|
|
||||||
// Update location when chosen
|
// Update location when chosen
|
||||||
group_select.onselect = function(group) {
|
group_select.onselect = function(selected_group) {
|
||||||
location_value = group;
|
|
||||||
location.textContent = group.name;
|
// Prevent selecting a situation that would produce a cycle
|
||||||
|
var current = selected_group;
|
||||||
|
while (current !== null) {
|
||||||
|
|
||||||
|
if (current.id === group.id) {
|
||||||
|
alert("Cannot move a group into a subgroup of itself.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
current = current.parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
location_value = selected_group;
|
||||||
|
location.textContent = selected_group.name;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user