From 102fd1ce612943e8c5e87d56bc13a4ed562cc746 Mon Sep 17 00:00:00 2001 From: James Muehlner Date: Thu, 22 Aug 2013 09:38:23 -0700 Subject: [PATCH] Ticket #399: Allow modifying SimpleConnectionDirectory. --- .../auth/simple/SimpleConnectionDirectory.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleConnectionDirectory.java b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleConnectionDirectory.java index 9905c97c0..09a919c08 100644 --- a/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleConnectionDirectory.java +++ b/guacamole-ext/src/main/java/net/sourceforge/guacamole/net/auth/simple/SimpleConnectionDirectory.java @@ -95,18 +95,30 @@ public class SimpleConnectionDirectory @Override public void add(Connection connection) throws GuacamoleException { - throw new GuacamoleSecurityException("Permission denied."); + + if(connections.containsKey(connection.getIdentifier())) + throw new GuacamoleException("Connection identifier already present."); + + connections.put(connection.getIdentifier(), connection); } @Override public void update(Connection connection) throws GuacamoleException { - throw new GuacamoleSecurityException("Permission denied."); + + if(!connections.containsKey(connection.getIdentifier())) + throw new GuacamoleException("Connection not found."); + + connections.put(connection.getIdentifier(), connection); } @Override public void remove(String identifier) throws GuacamoleException { - throw new GuacamoleSecurityException("Permission denied."); + + if(!connections.containsKey(identifier)) + throw new GuacamoleException("Connection not found."); + + connections.remove(identifier); } @Override