#268: Initial stubbed service calls.

This commit is contained in:
Michael Jumper
2013-02-09 19:09:37 -08:00
parent 9c34a8e9bf
commit 385a480d6f

View File

@@ -85,21 +85,47 @@
var user_manager = new GuacAdmin.UserManager(); var user_manager = new GuacAdmin.UserManager();
users.appendChild(user_manager.getElement()); users.appendChild(user_manager.getElement());
function updateUsers() {
var user_list = GuacamoleService.Users.list();
user_manager.setUsers(user_list);
}
user_manager.onsave = function(id, password, connections) { user_manager.onsave = function(id, password, connections) {
updateUsers();
console.log(id, password, connections); console.log(id, password, connections);
return true; return true;
}; };
user_manager.onadd = function(username) { user_manager.onadd = function(username) {
user_manager.add(username);
return true; try {
GuacamoleService.Users.create(username);
updateUsers();
return true;
}
catch (e) {
alert("User \"" + username + "\" cannot be created: " + e.message);
return false;
}
}; };
user_manager.onremove = function(username) { user_manager.onremove = function(username) {
user_manager.remove(username);
return true; try {
GuacamoleService.Users.remove(username);
updateUsers();
return true;
}
catch (e) {
alert("User \"" + username + "\" cannot be deleted: " + e.message);
return false;
}
}; };
updateUsers();
]]></script> ]]></script>
</body> </body>