mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 21:51:23 +00:00
Send parameters where possible.
This commit is contained in:
@@ -348,7 +348,7 @@ GuacAdmin.userPager = null;
|
|||||||
/**
|
/**
|
||||||
* Adds the user with the given name to the displayed user list.
|
* Adds the user with the given name to the displayed user list.
|
||||||
*/
|
*/
|
||||||
GuacAdmin.addUser = function(name) {
|
GuacAdmin.addUser = function(name, parameters) {
|
||||||
|
|
||||||
// Create user list item
|
// Create user list item
|
||||||
var item = new GuacAdmin.ListItem("user", name);
|
var item = new GuacAdmin.ListItem("user", name);
|
||||||
@@ -363,7 +363,7 @@ GuacAdmin.addUser = function(name) {
|
|||||||
else GuacAdmin.selected_user = name;
|
else GuacAdmin.selected_user = name;
|
||||||
|
|
||||||
// Get user permissions
|
// Get user permissions
|
||||||
var user_perms = GuacamoleService.Permissions.list(name);
|
var user_perms = GuacamoleService.Permissions.list(name, parameters);
|
||||||
|
|
||||||
// Permission deltas
|
// Permission deltas
|
||||||
var added_perms = new GuacamoleService.PermissionSet();
|
var added_perms = new GuacamoleService.PermissionSet();
|
||||||
@@ -590,8 +590,7 @@ GuacAdmin.addUser = function(name) {
|
|||||||
password = null;
|
password = null;
|
||||||
|
|
||||||
// Save user
|
// Save user
|
||||||
GuacamoleService.Users.update(
|
GuacamoleService.Users.update(GuacAdmin.selected_user, password, added_perms, removed_perms, parameters);
|
||||||
GuacAdmin.selected_user, password, added_perms, removed_perms);
|
|
||||||
deselect();
|
deselect();
|
||||||
GuacAdmin.reset();
|
GuacAdmin.reset();
|
||||||
|
|
||||||
@@ -629,7 +628,7 @@ GuacAdmin.addUser = function(name) {
|
|||||||
|
|
||||||
// Attempt to delete user
|
// Attempt to delete user
|
||||||
try {
|
try {
|
||||||
GuacamoleService.Users.remove(GuacAdmin.selected_user);
|
GuacamoleService.Users.remove(GuacAdmin.selected_user, parameters);
|
||||||
deselect();
|
deselect();
|
||||||
GuacAdmin.reset();
|
GuacAdmin.reset();
|
||||||
}
|
}
|
||||||
@@ -660,7 +659,7 @@ GuacAdmin.connectionPager = null;
|
|||||||
/**
|
/**
|
||||||
* Adds the given connection to the displayed connection list.
|
* Adds the given connection to the displayed connection list.
|
||||||
*/
|
*/
|
||||||
GuacAdmin.addConnection = function(connection) {
|
GuacAdmin.addConnection = function(connection, parameters) {
|
||||||
|
|
||||||
var item = new GuacAdmin.ListItem("connection", connection.id);
|
var item = new GuacAdmin.ListItem("connection", connection.id);
|
||||||
var item_element = item.getElement();
|
var item_element = item.getElement();
|
||||||
@@ -897,7 +896,7 @@ GuacAdmin.addConnection = function(connection) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update connection
|
// Update connection
|
||||||
GuacamoleService.Connections.update(updated_connection);
|
GuacamoleService.Connections.update(updated_connection, parameters);
|
||||||
deselect();
|
deselect();
|
||||||
GuacAdmin.reset();
|
GuacAdmin.reset();
|
||||||
|
|
||||||
@@ -935,7 +934,7 @@ GuacAdmin.addConnection = function(connection) {
|
|||||||
|
|
||||||
// Attempt to delete connection
|
// Attempt to delete connection
|
||||||
try {
|
try {
|
||||||
GuacamoleService.Connections.remove(GuacAdmin.selected_connection);
|
GuacamoleService.Connections.remove(GuacAdmin.selected_connection, parameters);
|
||||||
deselect();
|
deselect();
|
||||||
GuacAdmin.reset();
|
GuacAdmin.reset();
|
||||||
}
|
}
|
||||||
@@ -960,14 +959,17 @@ GuacAdmin.addConnection = function(connection) {
|
|||||||
|
|
||||||
GuacAdmin.reset = function() {
|
GuacAdmin.reset = function() {
|
||||||
|
|
||||||
|
// Get parameters from query string
|
||||||
|
var parameters = window.location.search.substring(1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show admin elements if admin permissions available
|
* Show admin elements if admin permissions available
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Query service for permissions, protocols, and connections
|
// Query service for permissions, protocols, and connections
|
||||||
GuacAdmin.cached_permissions = GuacamoleService.Permissions.list();
|
GuacAdmin.cached_permissions = GuacamoleService.Permissions.list(null, parameters);
|
||||||
GuacAdmin.cached_protocols = GuacamoleService.Protocols.list();
|
GuacAdmin.cached_protocols = GuacamoleService.Protocols.list(parameters);
|
||||||
GuacAdmin.cached_connections = GuacamoleService.Connections.list();
|
GuacAdmin.cached_connections = GuacamoleService.Connections.list(parameters);
|
||||||
|
|
||||||
// Sort connections by ID
|
// Sort connections by ID
|
||||||
GuacAdmin.cached_connections.sort(GuacamoleService.Connections.comparator);
|
GuacAdmin.cached_connections.sort(GuacamoleService.Connections.comparator);
|
||||||
@@ -1003,7 +1005,7 @@ GuacAdmin.reset = function() {
|
|||||||
try {
|
try {
|
||||||
var connection = new GuacamoleService.Connection(
|
var connection = new GuacamoleService.Connection(
|
||||||
GuacAdmin.cached_protocols[0].name, GuacAdmin.fields.connection_id.value);
|
GuacAdmin.cached_protocols[0].name, GuacAdmin.fields.connection_id.value);
|
||||||
GuacamoleService.Connections.create(connection);
|
GuacamoleService.Connections.create(connection, parameters);
|
||||||
GuacAdmin.fields.connection_id.value = "";
|
GuacAdmin.fields.connection_id.value = "";
|
||||||
GuacAdmin.reset();
|
GuacAdmin.reset();
|
||||||
}
|
}
|
||||||
@@ -1026,7 +1028,7 @@ GuacAdmin.reset = function() {
|
|||||||
|
|
||||||
// Attempt to create user
|
// Attempt to create user
|
||||||
try {
|
try {
|
||||||
GuacamoleService.Users.create(GuacAdmin.fields.username.value);
|
GuacamoleService.Users.create(GuacAdmin.fields.username.value, parameters);
|
||||||
GuacAdmin.fields.username.value = "";
|
GuacAdmin.fields.username.value = "";
|
||||||
GuacAdmin.reset();
|
GuacAdmin.reset();
|
||||||
}
|
}
|
||||||
@@ -1056,11 +1058,11 @@ GuacAdmin.reset = function() {
|
|||||||
GuacAdmin.userPager = new GuacUI.Pager(GuacAdmin.containers.user_list);
|
GuacAdmin.userPager = new GuacUI.Pager(GuacAdmin.containers.user_list);
|
||||||
|
|
||||||
// Add users to pager
|
// Add users to pager
|
||||||
var usernames = GuacamoleService.Users.list();
|
var usernames = GuacamoleService.Users.list(parameters);
|
||||||
for (i=0; i<usernames.length; i++) {
|
for (i=0; i<usernames.length; i++) {
|
||||||
if (GuacAdmin.cached_permissions.administer
|
if (GuacAdmin.cached_permissions.administer
|
||||||
|| usernames[i] in GuacAdmin.cached_permissions.update_user)
|
|| usernames[i] in GuacAdmin.cached_permissions.update_user)
|
||||||
GuacAdmin.addUser(usernames[i]);
|
GuacAdmin.addUser(usernames[i], parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If more than one page, add navigation buttons
|
// If more than one page, add navigation buttons
|
||||||
@@ -1090,7 +1092,7 @@ GuacAdmin.reset = function() {
|
|||||||
var connection = GuacAdmin.cached_connections[i];
|
var connection = GuacAdmin.cached_connections[i];
|
||||||
if (GuacAdmin.cached_permissions.administer
|
if (GuacAdmin.cached_permissions.administer
|
||||||
|| connection.id in GuacAdmin.cached_permissions.update_connection)
|
|| connection.id in GuacAdmin.cached_permissions.update_connection)
|
||||||
GuacAdmin.addConnection(connection);
|
GuacAdmin.addConnection(connection, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If more than one page, add navigation buttons
|
// If more than one page, add navigation buttons
|
||||||
|
@@ -146,7 +146,7 @@ GuacamoleRootUI.reset = function() {
|
|||||||
connections = GuacamoleService.Connections.list(parameters);
|
connections = GuacamoleService.Connections.list(parameters);
|
||||||
|
|
||||||
// Show admin elements if admin permissions available
|
// Show admin elements if admin permissions available
|
||||||
var permissions = GuacamoleService.Permissions.list();
|
var permissions = GuacamoleService.Permissions.list(null, parameters);
|
||||||
if (permissions.administer
|
if (permissions.administer
|
||||||
|| permissions.create_connection
|
|| permissions.create_connection
|
||||||
|| permissions.create_user
|
|| permissions.create_user
|
||||||
|
Reference in New Issue
Block a user