GUAC-1100: Commit to String identifiers.

This commit is contained in:
Michael Jumper
2015-02-12 23:07:45 -08:00
parent 37227d05e8
commit e9538a4167
27 changed files with 201 additions and 202 deletions

View File

@@ -44,12 +44,12 @@ public abstract class AbstractUser implements User {
private String password; private String password;
@Override @Override
public String getUsername() { public String getIdentifier() {
return username; return username;
} }
@Override @Override
public void setUsername(String username) { public void setIdentifier(String username) {
this.username = username; this.username = username;
} }

View File

@@ -36,7 +36,7 @@ import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
* *
* @author Michael Jumper * @author Michael Jumper
*/ */
public interface Connection { public interface Connection extends Identifiable {
/** /**
* Returns the name assigned to this Connection. * Returns the name assigned to this Connection.
@@ -51,24 +51,6 @@ public interface Connection {
*/ */
public void setName(String name); public void setName(String name);
/**
* Returns the unique identifier assigned to this Connection. All
* connections must have a deterministic, unique identifier which may not
* be null.
*
* @return
* The unique identifier assigned to this Connection, which may not be
* null.
*/
public String getIdentifier();
/**
* Sets the identifier assigned to this Connection.
*
* @param identifier The identifier to assign.
*/
public void setIdentifier(String identifier);
/** /**
* Returns the unique identifier of the parent ConnectionGroup for * Returns the unique identifier of the parent ConnectionGroup for
* this Connection. * this Connection.

View File

@@ -32,10 +32,29 @@ import org.glyptodon.guacamole.protocol.GuacamoleClientInformation;
* *
* @author James Muehlner * @author James Muehlner
*/ */
public interface ConnectionGroup { public interface ConnectionGroup extends Identifiable {
/**
* All legal types of connection group.
*/
public enum Type { public enum Type {
ORGANIZATIONAL, BALANCING
/**
* A connection group that purely organizes other connections or
* connection groups, serving only as a container. An organizational
* connection group is analogous to a directory or folder in a
* filesystem.
*/
ORGANIZATIONAL,
/**
* A connection group that acts as a load balancer. A balancing
* connection group can be connected to in the same manner as a
* connection, and will transparently route to the least-used
* underlying connection.
*/
BALANCING
}; };
/** /**
@@ -51,24 +70,6 @@ public interface ConnectionGroup {
*/ */
public void setName(String name); public void setName(String name);
/**
* Returns the unique identifier assigned to this ConnectionGroup. All
* connection groups must have a deterministic, unique identifier which may
* not be null.
*
* @return
* The unique identifier assigned to this ConnectionGroup, which may
* not be null.
*/
public String getIdentifier();
/**
* Sets the identifier assigned to this ConnectionGroup.
*
* @param identifier The identifier to assign.
*/
public void setIdentifier(String identifier);
/** /**
* Returns the unique identifier of the parent ConnectionGroup for * Returns the unique identifier of the parent ConnectionGroup for
* this ConnectionGroup. * this ConnectionGroup.
@@ -111,7 +112,7 @@ public interface ConnectionGroup {
* @throws GuacamoleException If an error occurs while creating the * @throws GuacamoleException If an error occurs while creating the
* Directory. * Directory.
*/ */
Directory<String, Connection> getConnectionDirectory() Directory<Connection> getConnectionDirectory()
throws GuacamoleException; throws GuacamoleException;
/** /**
@@ -125,7 +126,7 @@ public interface ConnectionGroup {
* @throws GuacamoleException If an error occurs while creating the * @throws GuacamoleException If an error occurs while creating the
* Directory. * Directory.
*/ */
Directory<String, ConnectionGroup> getConnectionGroupDirectory() Directory<ConnectionGroup> getConnectionGroupDirectory()
throws GuacamoleException; throws GuacamoleException;
/** /**

View File

@@ -34,11 +34,10 @@ import org.glyptodon.guacamole.GuacamoleException;
* function. * function.
* *
* @author Michael Jumper * @author Michael Jumper
* @param <IdentifierType> The type of identifier used to identify objects * @param <ObjectType>
* stored within this Directory. * The type of objects stored within this Directory.
* @param <ObjectType> The type of objects stored within this Directory.
*/ */
public interface Directory<IdentifierType, ObjectType> { public interface Directory<ObjectType> {
/** /**
* Returns the object having the given identifier. Note that changes to * Returns the object having the given identifier. Note that changes to
@@ -56,7 +55,7 @@ public interface Directory<IdentifierType, ObjectType> {
* object, or if permission for retrieving the * object, or if permission for retrieving the
* object is denied. * object is denied.
*/ */
ObjectType get(IdentifierType identifier) throws GuacamoleException; ObjectType get(String identifier) throws GuacamoleException;
/** /**
* Returns the objects having the given identifiers. Note that changes to * Returns the objects having the given identifiers. Note that changes to
@@ -78,7 +77,7 @@ public interface Directory<IdentifierType, ObjectType> {
* If an error occurs while retrieving the objects, or if permission * If an error occurs while retrieving the objects, or if permission
* to retrieve the requested objects is denied. * to retrieve the requested objects is denied.
*/ */
Collection<ObjectType> getAll(Collection<IdentifierType> identifiers) Collection<ObjectType> getAll(Collection<String> identifiers)
throws GuacamoleException; throws GuacamoleException;
/** /**
@@ -89,7 +88,7 @@ public interface Directory<IdentifierType, ObjectType> {
* @throws GuacamoleException If an error occurs while retrieving * @throws GuacamoleException If an error occurs while retrieving
* the identifiers. * the identifiers.
*/ */
Set<IdentifierType> getIdentifiers() throws GuacamoleException; Set<String> getIdentifiers() throws GuacamoleException;
/** /**
* Adds the given object to the overall set. * Adds the given object to the overall set.
@@ -121,7 +120,7 @@ public interface Directory<IdentifierType, ObjectType> {
* @throws GuacamoleException If an error occurs while removing the object, * @throws GuacamoleException If an error occurs while removing the object,
* or if removing object is not allowed. * or if removing object is not allowed.
*/ */
void remove(IdentifierType identifier) throws GuacamoleException; void remove(String identifier) throws GuacamoleException;
/** /**
* Moves the object with the given identifier to the given directory. * Moves the object with the given identifier to the given directory.
@@ -132,7 +131,7 @@ public interface Directory<IdentifierType, ObjectType> {
* @throws GuacamoleException If an error occurs while moving the object, * @throws GuacamoleException If an error occurs while moving the object,
* or if moving object is not allowed. * or if moving object is not allowed.
*/ */
void move(IdentifierType identifier, Directory<IdentifierType, ObjectType> directory) void move(String identifier, Directory<ObjectType> directory)
throws GuacamoleException; throws GuacamoleException;
} }

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole.net.auth;
/**
* An object which has a deterministic, unique identifier, which may not be
* null.
*
* @author Michael Jumper
*/
public interface Identifiable {
/**
* Returns the unique identifier assigned to this object. All identifiable
* objects must have a deterministic, unique identifier which may not be
* null.
*
* @return
* The unique identifier assigned to this object, which may not be
* null.
*/
public String getIdentifier();
/**
* Sets the identifier assigned to this object.
*
* @param identifier
* The identifier to assign.
*/
public void setIdentifier(String identifier);
}

View File

@@ -32,24 +32,7 @@ import org.glyptodon.guacamole.net.auth.permission.SystemPermissionSet;
* *
* @author Michael Jumper * @author Michael Jumper
*/ */
public interface User { public interface User extends Identifiable {
/**
* Returns the name of this user, which must be unique across all users.
* All users must have a deterministic, unique username which may not be
* null.
*
* @return
* The unique username of this user, which may not be null.
*/
public String getUsername();
/**
* Sets the name of this user, which must be unique across all users.
*
* @param username The name of this user.
*/
public void setUsername(String username);
/** /**
* Returns this user's password. Note that the password returned may be * Returns this user's password. Note that the password returned may be
@@ -92,7 +75,7 @@ public interface User {
* If an error occurs while retrieving permissions, or if reading all * If an error occurs while retrieving permissions, or if reading all
* permissions is not allowed. * permissions is not allowed.
*/ */
ObjectPermissionSet<String> getConnectionPermissions() ObjectPermissionSet getConnectionPermissions()
throws GuacamoleException; throws GuacamoleException;
/** /**
@@ -106,7 +89,7 @@ public interface User {
* If an error occurs while retrieving permissions, or if reading all * If an error occurs while retrieving permissions, or if reading all
* permissions is not allowed. * permissions is not allowed.
*/ */
ObjectPermissionSet<String> getConnectionGroupPermissions() ObjectPermissionSet getConnectionGroupPermissions()
throws GuacamoleException; throws GuacamoleException;
/** /**
@@ -119,6 +102,6 @@ public interface User {
* If an error occurs while retrieving permissions, or if reading all * If an error occurs while retrieving permissions, or if reading all
* permissions is not allowed. * permissions is not allowed.
*/ */
ObjectPermissionSet<String> getUserPermissions() throws GuacamoleException; ObjectPermissionSet getUserPermissions() throws GuacamoleException;
} }

View File

@@ -52,7 +52,7 @@ public interface UserContext {
* @throws GuacamoleException If an error occurs while creating the * @throws GuacamoleException If an error occurs while creating the
* Directory. * Directory.
*/ */
Directory<String, User> getUserDirectory() throws GuacamoleException; Directory<User> getUserDirectory() throws GuacamoleException;
/** /**
* Retrieves a connection group which can be used to view and manipulate * Retrieves a connection group which can be used to view and manipulate

View File

@@ -28,10 +28,8 @@ package org.glyptodon.guacamole.net.auth.permission;
* whole. * whole.
* *
* @author Michael Jumper * @author Michael Jumper
* @param <IdentifierType>
* The type of identifier used by the object this permission affects.
*/ */
public class ObjectPermission<IdentifierType> implements Permission<ObjectPermission.Type> { public class ObjectPermission implements Permission<ObjectPermission.Type> {
/** /**
* Specific types of object-level permissions. Each permission type is * Specific types of object-level permissions. Each permission type is
@@ -65,7 +63,7 @@ public class ObjectPermission<IdentifierType> implements Permission<ObjectPermis
* The identifier of the GuacamoleConfiguration associated with the * The identifier of the GuacamoleConfiguration associated with the
* operation affected by this permission. * operation affected by this permission.
*/ */
private final IdentifierType identifier; private final String identifier;
/** /**
* The type of operation affected by this permission. * The type of operation affected by this permission.
@@ -84,7 +82,7 @@ public class ObjectPermission<IdentifierType> implements Permission<ObjectPermis
* The identifier of the object associated with the operation affected * The identifier of the object associated with the operation affected
* by this permission. * by this permission.
*/ */
public ObjectPermission(Type type, IdentifierType identifier) { public ObjectPermission(Type type, String identifier) {
this.identifier = identifier; this.identifier = identifier;
this.type = type; this.type = type;
@@ -98,7 +96,7 @@ public class ObjectPermission<IdentifierType> implements Permission<ObjectPermis
* @return The identifier of the specific object affected by this * @return The identifier of the specific object affected by this
* permission. * permission.
*/ */
public IdentifierType getObjectIdentifier() { public String getObjectIdentifier() {
return identifier; return identifier;
} }

View File

@@ -32,12 +32,8 @@ import org.glyptodon.guacamole.GuacamoleException;
* an associated unique identifier. * an associated unique identifier.
* *
* @author Michael Jumper * @author Michael Jumper
* @param <IdentifierType>
* The type of identifier used to identify objects affected by permissions
* stored in this ObjectPermissionSet.
*/ */
public interface ObjectPermissionSet<IdentifierType> public interface ObjectPermissionSet extends PermissionSet<ObjectPermission> {
extends PermissionSet<ObjectPermission<IdentifierType>> {
/** /**
* Tests whether the permission of the given type is granted for the * Tests whether the permission of the given type is granted for the
@@ -58,7 +54,7 @@ public interface ObjectPermissionSet<IdentifierType>
* cannot be checked due to lack of permissions to do so. * cannot be checked due to lack of permissions to do so.
*/ */
boolean hasPermission(ObjectPermission.Type permission, boolean hasPermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException; String identifier) throws GuacamoleException;
/** /**
* Adds the specified permission for the object having the given * Adds the specified permission for the object having the given
@@ -76,7 +72,7 @@ public interface ObjectPermissionSet<IdentifierType>
* add permissions is denied. * add permissions is denied.
*/ */
void addPermission(ObjectPermission.Type permission, void addPermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException; String identifier) throws GuacamoleException;
/** /**
* Removes the specified permission for the object having the given * Removes the specified permission for the object having the given
@@ -94,7 +90,7 @@ public interface ObjectPermissionSet<IdentifierType>
* to remove permissions is denied. * to remove permissions is denied.
*/ */
void removePermission(ObjectPermission.Type permission, void removePermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException; String identifier) throws GuacamoleException;
/** /**
* Tests whether this user has the specified permissions for the objects * Tests whether this user has the specified permissions for the objects
@@ -119,20 +115,20 @@ public interface ObjectPermissionSet<IdentifierType>
* If an error occurs while checking permissions, or if permissions * If an error occurs while checking permissions, or if permissions
* cannot be checked due to lack of permissions to do so. * cannot be checked due to lack of permissions to do so.
*/ */
Collection<IdentifierType> getAccessibleObjects( Collection<String> getAccessibleObjects(
Collection<ObjectPermission.Type> permissions, Collection<ObjectPermission.Type> permissions,
Collection<IdentifierType> identifiers) throws GuacamoleException; Collection<String> identifiers) throws GuacamoleException;
@Override @Override
Set<ObjectPermission<IdentifierType>> getPermissions() Set<ObjectPermission> getPermissions()
throws GuacamoleException; throws GuacamoleException;
@Override @Override
void addPermissions(Set<ObjectPermission<IdentifierType>> permissions) void addPermissions(Set<ObjectPermission> permissions)
throws GuacamoleException; throws GuacamoleException;
@Override @Override
void removePermissions(Set<ObjectPermission<IdentifierType>> permissions) void removePermissions(Set<ObjectPermission> permissions)
throws GuacamoleException; throws GuacamoleException;
} }

View File

@@ -35,7 +35,7 @@ import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
* *
* @author Michael Jumper * @author Michael Jumper
*/ */
public class SimpleConnectionDirectory extends SimpleDirectory<String, Connection> { public class SimpleConnectionDirectory extends SimpleDirectory<Connection> {
/** /**
* The Map of Connections to provide access to. * The Map of Connections to provide access to.

View File

@@ -44,13 +44,13 @@ public class SimpleConnectionGroup extends AbstractConnectionGroup {
* Underlying connection directory, containing all connections within this * Underlying connection directory, containing all connections within this
* group. * group.
*/ */
private final Directory<String, Connection> connectionDirectory; private final Directory<Connection> connectionDirectory;
/** /**
* Underlying connection group directory, containing all connections within * Underlying connection group directory, containing all connections within
* this group. * this group.
*/ */
private final Directory<String, ConnectionGroup> connectionGroupDirectory; private final Directory<ConnectionGroup> connectionGroupDirectory;
/** /**
* Creates a new SimpleConnectionGroup having the given name and identifier * Creates a new SimpleConnectionGroup having the given name and identifier
@@ -64,8 +64,8 @@ public class SimpleConnectionGroup extends AbstractConnectionGroup {
* when requested. * when requested.
*/ */
public SimpleConnectionGroup(String name, String identifier, public SimpleConnectionGroup(String name, String identifier,
Directory<String, Connection> connectionDirectory, Directory<Connection> connectionDirectory,
Directory<String, ConnectionGroup> connectionGroupDirectory) { Directory<ConnectionGroup> connectionGroupDirectory) {
// Set name // Set name
setName(name); setName(name);
@@ -83,13 +83,13 @@ public class SimpleConnectionGroup extends AbstractConnectionGroup {
} }
@Override @Override
public Directory<String, Connection> getConnectionDirectory() public Directory<Connection> getConnectionDirectory()
throws GuacamoleException { throws GuacamoleException {
return connectionDirectory; return connectionDirectory;
} }
@Override @Override
public Directory<String, ConnectionGroup> getConnectionGroupDirectory() public Directory<ConnectionGroup> getConnectionGroupDirectory()
throws GuacamoleException { throws GuacamoleException {
return connectionGroupDirectory; return connectionGroupDirectory;
} }

View File

@@ -35,7 +35,7 @@ import org.glyptodon.guacamole.net.auth.ConnectionGroup;
* @author James Muehlner * @author James Muehlner
*/ */
public class SimpleConnectionGroupDirectory public class SimpleConnectionGroupDirectory
extends SimpleDirectory<String, ConnectionGroup> { extends SimpleDirectory<ConnectionGroup> {
/** /**
* The Map of ConnectionGroups to provide access to. * The Map of ConnectionGroups to provide access to.

View File

@@ -37,20 +37,15 @@ import org.glyptodon.guacamole.net.auth.Directory;
* will affect the available contents of this SimpleDirectory. * will affect the available contents of this SimpleDirectory.
* *
* @author Michael Jumper * @author Michael Jumper
* @param <IdentifierType>
* The type of identifier used to identify objects stored within this
* SimpleDirectory.
*
* @param <ObjectType> * @param <ObjectType>
* The type of objects stored within this SimpleDirectory. * The type of objects stored within this SimpleDirectory.
*/ */
public class SimpleDirectory<IdentifierType, ObjectType> public class SimpleDirectory<ObjectType> implements Directory<ObjectType> {
implements Directory<IdentifierType, ObjectType> {
/** /**
* The Map of objects to provide access to. * The Map of objects to provide access to.
*/ */
private Map<IdentifierType, ObjectType> objects = Collections.EMPTY_MAP; private Map<String, ObjectType> objects = Collections.EMPTY_MAP;
/** /**
* Creates a new empty SimpleDirectory which does not provide access to * Creates a new empty SimpleDirectory which does not provide access to
@@ -66,7 +61,7 @@ public class SimpleDirectory<IdentifierType, ObjectType>
* @param objects * @param objects
* The Map of objects to provide access to. * The Map of objects to provide access to.
*/ */
public SimpleDirectory(Map<IdentifierType, ObjectType> objects) { public SimpleDirectory(Map<String, ObjectType> objects) {
this.objects = objects; this.objects = objects;
} }
@@ -78,7 +73,7 @@ public class SimpleDirectory<IdentifierType, ObjectType>
* @param objects * @param objects
* The Map of objects to provide access to. * The Map of objects to provide access to.
*/ */
protected void setObjects(Map<IdentifierType, ObjectType> objects) { protected void setObjects(Map<String, ObjectType> objects) {
this.objects = objects; this.objects = objects;
} }
@@ -90,25 +85,25 @@ public class SimpleDirectory<IdentifierType, ObjectType>
* @return * @return
* The Map of objects which currently backs this SimpleDirectory. * The Map of objects which currently backs this SimpleDirectory.
*/ */
protected Map<IdentifierType, ObjectType> getObjects() { protected Map<String, ObjectType> getObjects() {
return objects; return objects;
} }
@Override @Override
public ObjectType get(IdentifierType identifier) public ObjectType get(String identifier)
throws GuacamoleException { throws GuacamoleException {
return objects.get(identifier); return objects.get(identifier);
} }
@Override @Override
public Collection<ObjectType> getAll(Collection<IdentifierType> identifiers) public Collection<ObjectType> getAll(Collection<String> identifiers)
throws GuacamoleException { throws GuacamoleException {
// Create collection which has an appropriate initial size // Create collection which has an appropriate initial size
Collection<ObjectType> foundObjects = new ArrayList<ObjectType>(identifiers.size()); Collection<ObjectType> foundObjects = new ArrayList<ObjectType>(identifiers.size());
// Populate collection with matching objects // Populate collection with matching objects
for (IdentifierType identifier : identifiers) { for (String identifier : identifiers) {
// Add the object which has the current identifier, if any // Add the object which has the current identifier, if any
ObjectType object = objects.get(identifier); ObjectType object = objects.get(identifier);
@@ -122,7 +117,7 @@ public class SimpleDirectory<IdentifierType, ObjectType>
} }
@Override @Override
public Set<IdentifierType> getIdentifiers() throws GuacamoleException { public Set<String> getIdentifiers() throws GuacamoleException {
return objects.keySet(); return objects.keySet();
} }
@@ -139,13 +134,12 @@ public class SimpleDirectory<IdentifierType, ObjectType>
} }
@Override @Override
public void remove(IdentifierType identifier) throws GuacamoleException { public void remove(String identifier) throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied."); throw new GuacamoleSecurityException("Permission denied.");
} }
@Override @Override
public void move(IdentifierType identifier, public void move(String identifier, Directory<ObjectType> directory)
Directory<IdentifierType, ObjectType> directory)
throws GuacamoleException { throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied."); throw new GuacamoleSecurityException("Permission denied.");
} }

View File

@@ -36,17 +36,13 @@ import org.glyptodon.guacamole.net.auth.permission.ObjectPermissionSet;
* of Permissions to determine which permissions are present. * of Permissions to determine which permissions are present.
* *
* @author Michael Jumper * @author Michael Jumper
* @param <IdentifierType>
* The type of identifier used to identify objects affected by permissions
* stored in this SimpleObjectPermissionSet.
*/ */
public class SimpleObjectPermissionSet<IdentifierType> public class SimpleObjectPermissionSet implements ObjectPermissionSet {
implements ObjectPermissionSet<IdentifierType> {
/** /**
* The set of all permissions currently granted. * The set of all permissions currently granted.
*/ */
private Set<ObjectPermission<IdentifierType>> permissions = Collections.EMPTY_SET; private Set<ObjectPermission> permissions = Collections.EMPTY_SET;
/** /**
* Creates a new empty SimpleObjectPermissionSet. * Creates a new empty SimpleObjectPermissionSet.
@@ -62,7 +58,7 @@ public class SimpleObjectPermissionSet<IdentifierType>
* The Set of permissions this SimpleObjectPermissionSet should * The Set of permissions this SimpleObjectPermissionSet should
* contain. * contain.
*/ */
public SimpleObjectPermissionSet(Set<ObjectPermission<IdentifierType>> permissions) { public SimpleObjectPermissionSet(Set<ObjectPermission> permissions) {
this.permissions = permissions; this.permissions = permissions;
} }
@@ -74,21 +70,21 @@ public class SimpleObjectPermissionSet<IdentifierType>
* The Set of permissions this SimpleObjectPermissionSet should * The Set of permissions this SimpleObjectPermissionSet should
* contain. * contain.
*/ */
protected void setPermissions(Set<ObjectPermission<IdentifierType>> permissions) { protected void setPermissions(Set<ObjectPermission> permissions) {
this.permissions = permissions; this.permissions = permissions;
} }
@Override @Override
public Set<ObjectPermission<IdentifierType>> getPermissions() { public Set<ObjectPermission> getPermissions() {
return permissions; return permissions;
} }
@Override @Override
public boolean hasPermission(ObjectPermission.Type permission, public boolean hasPermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException { String identifier) throws GuacamoleException {
ObjectPermission<IdentifierType> objectPermission = ObjectPermission objectPermission =
new ObjectPermission<IdentifierType>(permission, identifier); new ObjectPermission(permission, identifier);
return permissions.contains(objectPermission); return permissions.contains(objectPermission);
@@ -96,29 +92,29 @@ public class SimpleObjectPermissionSet<IdentifierType>
@Override @Override
public void addPermission(ObjectPermission.Type permission, public void addPermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException { String identifier) throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied."); throw new GuacamoleSecurityException("Permission denied.");
} }
@Override @Override
public void removePermission(ObjectPermission.Type permission, public void removePermission(ObjectPermission.Type permission,
IdentifierType identifier) throws GuacamoleException { String identifier) throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied."); throw new GuacamoleSecurityException("Permission denied.");
} }
@Override @Override
public Collection<IdentifierType> getAccessibleObjects( public Collection<String> getAccessibleObjects(
Collection<ObjectPermission.Type> permissionTypes, Collection<ObjectPermission.Type> permissionTypes,
Collection<IdentifierType> identifiers) throws GuacamoleException { Collection<String> identifiers) throws GuacamoleException {
Collection<IdentifierType> accessibleObjects = new ArrayList<IdentifierType>(permissions.size()); Collection<String> accessibleObjects = new ArrayList<String>(permissions.size());
// For each identifier/permission combination // For each identifier/permission combination
for (IdentifierType identifier : identifiers) { for (String identifier : identifiers) {
for (ObjectPermission.Type permissionType : permissionTypes) { for (ObjectPermission.Type permissionType : permissionTypes) {
// Add identifier if at least one requested permission is granted // Add identifier if at least one requested permission is granted
ObjectPermission<IdentifierType> permission = new ObjectPermission<IdentifierType>(permissionType, identifier); ObjectPermission permission = new ObjectPermission(permissionType, identifier);
if (permissions.contains(permission)) { if (permissions.contains(permission)) {
accessibleObjects.add(identifier); accessibleObjects.add(identifier);
break; break;
@@ -132,13 +128,13 @@ public class SimpleObjectPermissionSet<IdentifierType>
} }
@Override @Override
public void addPermissions(Set<ObjectPermission<IdentifierType>> permissions) public void addPermissions(Set<ObjectPermission> permissions)
throws GuacamoleException { throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied."); throw new GuacamoleSecurityException("Permission denied.");
} }
@Override @Override
public void removePermissions(Set<ObjectPermission<IdentifierType>> permissions) public void removePermissions(Set<ObjectPermission> permissions)
throws GuacamoleException { throws GuacamoleException {
throw new GuacamoleSecurityException("Permission denied."); throw new GuacamoleSecurityException("Permission denied.");
} }

View File

@@ -28,9 +28,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.glyptodon.guacamole.GuacamoleException; import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.net.auth.AbstractUser; import org.glyptodon.guacamole.net.auth.AbstractUser;
import org.glyptodon.guacamole.net.auth.Connection;
import org.glyptodon.guacamole.net.auth.ConnectionGroup; import org.glyptodon.guacamole.net.auth.ConnectionGroup;
import org.glyptodon.guacamole.net.auth.User;
import org.glyptodon.guacamole.net.auth.permission.ObjectPermission; import org.glyptodon.guacamole.net.auth.permission.ObjectPermission;
import org.glyptodon.guacamole.net.auth.permission.ObjectPermissionSet; import org.glyptodon.guacamole.net.auth.permission.ObjectPermissionSet;
import org.glyptodon.guacamole.net.auth.permission.SystemPermissionSet; import org.glyptodon.guacamole.net.auth.permission.SystemPermissionSet;
@@ -46,14 +44,14 @@ public class SimpleUser extends AbstractUser {
/** /**
* All connection permissions granted to this user. * All connection permissions granted to this user.
*/ */
private final Set<ObjectPermission<String>> connectionPermissions = private final Set<ObjectPermission> connectionPermissions =
new HashSet<ObjectPermission<String>>(); new HashSet<ObjectPermission>();
/** /**
* All connection group permissions granted to this user. * All connection group permissions granted to this user.
*/ */
private final Set<ObjectPermission<String>> connectionGroupPermissions = private final Set<ObjectPermission> connectionGroupPermissions =
new HashSet<ObjectPermission<String>>(); new HashSet<ObjectPermission>();
/** /**
* Creates a completely uninitialized SimpleUser. * Creates a completely uninitialized SimpleUser.
@@ -73,7 +71,7 @@ public class SimpleUser extends AbstractUser {
Collection<ConnectionGroup> groups) { Collection<ConnectionGroup> groups) {
// Set username // Set username
setUsername(username); setIdentifier(username);
// Add connection permissions // Add connection permissions
for (String identifier : configs.keySet()) { for (String identifier : configs.keySet()) {
@@ -112,21 +110,21 @@ public class SimpleUser extends AbstractUser {
} }
@Override @Override
public ObjectPermissionSet<String> getConnectionPermissions() public ObjectPermissionSet getConnectionPermissions()
throws GuacamoleException { throws GuacamoleException {
return new SimpleObjectPermissionSet<String>(connectionPermissions); return new SimpleObjectPermissionSet(connectionPermissions);
} }
@Override @Override
public ObjectPermissionSet<String> getConnectionGroupPermissions() public ObjectPermissionSet getConnectionGroupPermissions()
throws GuacamoleException { throws GuacamoleException {
return new SimpleObjectPermissionSet<String>(connectionGroupPermissions); return new SimpleObjectPermissionSet(connectionGroupPermissions);
} }
@Override @Override
public ObjectPermissionSet<String> getUserPermissions() public ObjectPermissionSet getUserPermissions()
throws GuacamoleException { throws GuacamoleException {
return new SimpleObjectPermissionSet<String>(); return new SimpleObjectPermissionSet();
} }
} }

View File

@@ -51,7 +51,7 @@ public class SimpleUserContext implements UserContext {
* The Directory with access only to the User associated with this * The Directory with access only to the User associated with this
* UserContext. * UserContext.
*/ */
private final Directory<String, User> userDirectory; private final Directory<User> userDirectory;
/** /**
* The ConnectionGroup with access only to those Connections that the User * The ConnectionGroup with access only to those Connections that the User
@@ -102,7 +102,7 @@ public class SimpleUserContext implements UserContext {
} }
@Override @Override
public Directory<String, User> getUserDirectory() public Directory<User> getUserDirectory()
throws GuacamoleException { throws GuacamoleException {
return userDirectory; return userDirectory;
} }

View File

@@ -31,7 +31,7 @@ import org.glyptodon.guacamole.net.auth.User;
* *
* @author Michael Jumper * @author Michael Jumper
*/ */
public class SimpleUserDirectory extends SimpleDirectory<String, User> { public class SimpleUserDirectory extends SimpleDirectory<User> {
/** /**
* Creates a new SimpleUserDirectory which provides access to the single * Creates a new SimpleUserDirectory which provides access to the single
@@ -40,7 +40,7 @@ public class SimpleUserDirectory extends SimpleDirectory<String, User> {
* @param user The user to provide access to. * @param user The user to provide access to.
*/ */
public SimpleUserDirectory(User user) { public SimpleUserDirectory(User user) {
super(Collections.singletonMap(user.getUsername(), user)); super(Collections.singletonMap(user.getIdentifier(), user));
} }
} }

View File

@@ -213,19 +213,19 @@ public class TunnelRequestService {
UserContext context = session.getUserContext(); UserContext context = session.getUserContext();
// Get connection directory // Get connection directory
Directory<String, Connection> directory = Directory<Connection> directory =
context.getRootConnectionGroup().getConnectionDirectory(); context.getRootConnectionGroup().getConnectionDirectory();
// Get authorized connection // Get authorized connection
Connection connection = directory.get(id); Connection connection = directory.get(id);
if (connection == null) { if (connection == null) {
logger.info("Connection \"{}\" does not exist for user \"{}\".", id, context.self().getUsername()); logger.info("Connection \"{}\" does not exist for user \"{}\".", id, context.self().getIdentifier());
throw new GuacamoleSecurityException("Requested connection is not authorized."); throw new GuacamoleSecurityException("Requested connection is not authorized.");
} }
// Connect socket // Connect socket
socket = connection.connect(info); socket = connection.connect(info);
logger.info("User \"{}\" successfully connected to \"{}\".", context.self().getUsername(), id); logger.info("User \"{}\" successfully connected to \"{}\".", context.self().getIdentifier(), id);
break; break;
} }
@@ -235,19 +235,19 @@ public class TunnelRequestService {
UserContext context = session.getUserContext(); UserContext context = session.getUserContext();
// Get connection group directory // Get connection group directory
Directory<String, ConnectionGroup> directory = Directory<ConnectionGroup> directory =
context.getRootConnectionGroup().getConnectionGroupDirectory(); context.getRootConnectionGroup().getConnectionGroupDirectory();
// Get authorized connection group // Get authorized connection group
ConnectionGroup group = directory.get(id); ConnectionGroup group = directory.get(id);
if (group == null) { if (group == null) {
logger.info("Connection group \"{}\" does not exist for user \"{}\".", id, context.self().getUsername()); logger.info("Connection group \"{}\" does not exist for user \"{}\".", id, context.self().getIdentifier());
throw new GuacamoleSecurityException("Requested connection group is not authorized."); throw new GuacamoleSecurityException("Requested connection group is not authorized.");
} }
// Connect socket // Connect socket
socket = group.connect(info); socket = group.connect(info);
logger.info("User \"{}\" successfully connected to group \"{}\".", context.self().getUsername(), id); logger.info("User \"{}\" successfully connected to group \"{}\".", context.self().getIdentifier(), id);
break; break;
} }

View File

@@ -59,7 +59,7 @@ public class ObjectRetrievalService {
String identifier) throws GuacamoleException { String identifier) throws GuacamoleException {
// Get user directory // Get user directory
Directory<String, User> directory = userContext.getUserDirectory(); Directory<User> directory = userContext.getUserDirectory();
// Pull specified user // Pull specified user
User user = directory.get(identifier); User user = directory.get(identifier);
@@ -91,7 +91,7 @@ public class ObjectRetrievalService {
// Get root directory // Get root directory
ConnectionGroup rootGroup = userContext.getRootConnectionGroup(); ConnectionGroup rootGroup = userContext.getRootConnectionGroup();
Directory<String, Connection> directory = rootGroup.getConnectionDirectory(); Directory<Connection> directory = rootGroup.getConnectionDirectory();
// Pull specified connection // Pull specified connection
Connection connection = directory.get(identifier); Connection connection = directory.get(identifier);
@@ -132,7 +132,7 @@ public class ObjectRetrievalService {
return rootGroup; return rootGroup;
// Pull specified connection group otherwise // Pull specified connection group otherwise
Directory<String, ConnectionGroup> directory = rootGroup.getConnectionGroupDirectory(); Directory<ConnectionGroup> directory = rootGroup.getConnectionGroupDirectory();
ConnectionGroup connectionGroup = directory.get(identifier); ConnectionGroup connectionGroup = directory.get(identifier);
if (connectionGroup == null) if (connectionGroup == null)

View File

@@ -188,8 +188,8 @@ public class TokenRESTService {
tokenSessionMap.put(authToken, new GuacamoleSession(credentials, userContext)); tokenSessionMap.put(authToken, new GuacamoleSession(credentials, userContext));
} }
logger.debug("Login was successful for user \"{}\".", userContext.self().getUsername()); logger.debug("Login was successful for user \"{}\".", userContext.self().getIdentifier());
return new APIAuthToken(authToken, userContext.self().getUsername()); return new APIAuthToken(authToken, userContext.self().getIdentifier());
} }

View File

@@ -139,7 +139,7 @@ public class ConnectionRESTService {
// Retrieve permission sets // Retrieve permission sets
SystemPermissionSet systemPermissions = self.getSystemPermissions(); SystemPermissionSet systemPermissions = self.getSystemPermissions();
ObjectPermissionSet<String> connectionPermissions = self.getConnectionPermissions(); ObjectPermissionSet connectionPermissions = self.getConnectionPermissions();
// Deny access if adminstrative or update permission is missing // Deny access if adminstrative or update permission is missing
if (!systemPermissions.hasPermission(SystemPermission.Type.ADMINISTER) if (!systemPermissions.hasPermission(SystemPermission.Type.ADMINISTER)
@@ -211,7 +211,7 @@ public class ConnectionRESTService {
// Get the connection directory // Get the connection directory
ConnectionGroup rootGroup = userContext.getRootConnectionGroup(); ConnectionGroup rootGroup = userContext.getRootConnectionGroup();
Directory<String, Connection> connectionDirectory = Directory<Connection> connectionDirectory =
rootGroup.getConnectionDirectory(); rootGroup.getConnectionDirectory();
// Delete the specified connection // Delete the specified connection
@@ -252,7 +252,7 @@ public class ConnectionRESTService {
ConnectionGroup parentConnectionGroup = retrievalService.retrieveConnectionGroup(userContext, parentID); ConnectionGroup parentConnectionGroup = retrievalService.retrieveConnectionGroup(userContext, parentID);
// Add the new connection // Add the new connection
Directory<String, Connection> connectionDirectory = parentConnectionGroup.getConnectionDirectory(); Directory<Connection> connectionDirectory = parentConnectionGroup.getConnectionDirectory();
connectionDirectory.add(new APIConnectionWrapper(connection)); connectionDirectory.add(new APIConnectionWrapper(connection));
// Return the new connection identifier // Return the new connection identifier
@@ -292,7 +292,7 @@ public class ConnectionRESTService {
// Get the connection directory // Get the connection directory
ConnectionGroup rootGroup = userContext.getRootConnectionGroup(); ConnectionGroup rootGroup = userContext.getRootConnectionGroup();
Directory<String, Connection> connectionDirectory = Directory<Connection> connectionDirectory =
rootGroup.getConnectionDirectory(); rootGroup.getConnectionDirectory();
// Retrieve connection to update // Retrieve connection to update

View File

@@ -92,12 +92,12 @@ public class APIConnectionGroupWrapper implements ConnectionGroup {
} }
@Override @Override
public Directory<String, Connection> getConnectionDirectory() throws GuacamoleException { public Directory<Connection> getConnectionDirectory() throws GuacamoleException {
throw new UnsupportedOperationException("Operation not supported."); throw new UnsupportedOperationException("Operation not supported.");
} }
@Override @Override
public Directory<String, ConnectionGroup> getConnectionGroupDirectory() throws GuacamoleException { public Directory<ConnectionGroup> getConnectionGroupDirectory() throws GuacamoleException {
throw new UnsupportedOperationException("Operation not supported."); throw new UnsupportedOperationException("Operation not supported.");
} }

View File

@@ -104,7 +104,7 @@ public class ConnectionGroupRESTService {
List<ObjectPermission.Type> permissions) throws GuacamoleException { List<ObjectPermission.Type> permissions) throws GuacamoleException {
// Retrieve connection permissions // Retrieve connection permissions
ObjectPermissionSet<String> connectionPermissions = user.getConnectionPermissions(); ObjectPermissionSet connectionPermissions = user.getConnectionPermissions();
// Determine whether user has at least one of the given permissions // Determine whether user has at least one of the given permissions
for (ObjectPermission.Type permission : permissions) { for (ObjectPermission.Type permission : permissions) {
@@ -138,7 +138,7 @@ public class ConnectionGroupRESTService {
List<ObjectPermission.Type> permissions) throws GuacamoleException { List<ObjectPermission.Type> permissions) throws GuacamoleException {
// Retrieve connection group permissions // Retrieve connection group permissions
ObjectPermissionSet<String> connectionGroupPermissions = user.getConnectionGroupPermissions(); ObjectPermissionSet connectionGroupPermissions = user.getConnectionGroupPermissions();
// Determine whether user has at least one of the given permissions // Determine whether user has at least one of the given permissions
for (ObjectPermission.Type permission : permissions) { for (ObjectPermission.Type permission : permissions) {
@@ -211,7 +211,7 @@ public class ConnectionGroupRESTService {
// Query all child connections // Query all child connections
Collection<APIConnection> apiConnections = new ArrayList<APIConnection>(); Collection<APIConnection> apiConnections = new ArrayList<APIConnection>();
Directory<String, Connection> connectionDirectory = connectionGroup.getConnectionDirectory(); Directory<Connection> connectionDirectory = connectionGroup.getConnectionDirectory();
for (String childIdentifier : connectionDirectory.getIdentifiers()) { for (String childIdentifier : connectionDirectory.getIdentifiers()) {
@@ -231,7 +231,7 @@ public class ConnectionGroupRESTService {
// Query all child connection groups // Query all child connection groups
Collection<APIConnectionGroup> apiConnectionGroups = new ArrayList<APIConnectionGroup>(); Collection<APIConnectionGroup> apiConnectionGroups = new ArrayList<APIConnectionGroup>();
Directory<String, ConnectionGroup> groupDirectory = connectionGroup.getConnectionGroupDirectory(); Directory<ConnectionGroup> groupDirectory = connectionGroup.getConnectionGroupDirectory();
for (String childIdentifier : groupDirectory.getIdentifiers()) { for (String childIdentifier : groupDirectory.getIdentifiers()) {
@@ -356,7 +356,7 @@ public class ConnectionGroupRESTService {
// Get the connection group directory // Get the connection group directory
ConnectionGroup rootGroup = userContext.getRootConnectionGroup(); ConnectionGroup rootGroup = userContext.getRootConnectionGroup();
Directory<String, ConnectionGroup> connectionGroupDirectory = Directory<ConnectionGroup> connectionGroupDirectory =
rootGroup.getConnectionGroupDirectory(); rootGroup.getConnectionGroupDirectory();
// Delete the connection group // Delete the connection group
@@ -399,7 +399,7 @@ public class ConnectionGroupRESTService {
ConnectionGroup parentConnectionGroup = retrievalService.retrieveConnectionGroup(userContext, parentID); ConnectionGroup parentConnectionGroup = retrievalService.retrieveConnectionGroup(userContext, parentID);
// Add the new connection group // Add the new connection group
Directory<String, ConnectionGroup> connectionGroupDirectory = parentConnectionGroup.getConnectionGroupDirectory(); Directory<ConnectionGroup> connectionGroupDirectory = parentConnectionGroup.getConnectionGroupDirectory();
connectionGroupDirectory.add(new APIConnectionGroupWrapper(connectionGroup)); connectionGroupDirectory.add(new APIConnectionGroupWrapper(connectionGroup));
// Return the new connection group identifier // Return the new connection group identifier
@@ -440,7 +440,7 @@ public class ConnectionGroupRESTService {
// Get the connection group directory // Get the connection group directory
ConnectionGroup rootGroup = userContext.getRootConnectionGroup(); ConnectionGroup rootGroup = userContext.getRootConnectionGroup();
Directory<String, ConnectionGroup> connectionGroupDirectory = Directory<ConnectionGroup> connectionGroupDirectory =
rootGroup.getConnectionGroupDirectory(); rootGroup.getConnectionGroupDirectory();
// Retrieve connection group to update // Retrieve connection group to update

View File

@@ -114,10 +114,10 @@ public class APIPermissionSet {
* ObjectPermissionSet. * ObjectPermissionSet.
*/ */
private void addObjectPermissions(Map<String, Set<ObjectPermission.Type>> permissions, private void addObjectPermissions(Map<String, Set<ObjectPermission.Type>> permissions,
ObjectPermissionSet<String> permSet) throws GuacamoleException { ObjectPermissionSet permSet) throws GuacamoleException {
// Add all provided object permissions // Add all provided object permissions
for (ObjectPermission<String> permission : permSet.getPermissions()) { for (ObjectPermission permission : permSet.getPermissions()) {
// Get associated set of permissions // Get associated set of permissions
String identifier = permission.getObjectIdentifier(); String identifier = permission.getObjectIdentifier();

View File

@@ -55,7 +55,7 @@ public class APIUser {
* @param user The User to construct the APIUser from. * @param user The User to construct the APIUser from.
*/ */
public APIUser(User user) { public APIUser(User user) {
this.username = user.getUsername(); this.username = user.getIdentifier();
this.password = user.getPassword(); this.password = user.getPassword();
} }

View File

@@ -52,12 +52,12 @@ public class APIUserWrapper implements User {
} }
@Override @Override
public String getUsername() { public String getIdentifier() {
return apiUser.getUsername(); return apiUser.getUsername();
} }
@Override @Override
public void setUsername(String username) { public void setIdentifier(String username) {
apiUser.setUsername(username); apiUser.setUsername(username);
} }
@@ -78,19 +78,19 @@ public class APIUserWrapper implements User {
} }
@Override @Override
public ObjectPermissionSet<String> getConnectionPermissions() public ObjectPermissionSet getConnectionPermissions()
throws GuacamoleException { throws GuacamoleException {
throw new GuacamoleUnsupportedException("APIUserWrapper does not provide permission access."); throw new GuacamoleUnsupportedException("APIUserWrapper does not provide permission access.");
} }
@Override @Override
public ObjectPermissionSet<String> getConnectionGroupPermissions() public ObjectPermissionSet getConnectionGroupPermissions()
throws GuacamoleException { throws GuacamoleException {
throw new GuacamoleUnsupportedException("APIUserWrapper does not provide permission access."); throw new GuacamoleUnsupportedException("APIUserWrapper does not provide permission access.");
} }
@Override @Override
public ObjectPermissionSet<String> getUserPermissions() public ObjectPermissionSet getUserPermissions()
throws GuacamoleException { throws GuacamoleException {
throw new GuacamoleUnsupportedException("APIUserWrapper does not provide permission access."); throw new GuacamoleUnsupportedException("APIUserWrapper does not provide permission access.");
} }

View File

@@ -151,12 +151,12 @@ public class UserRESTService {
boolean isAdmin = systemPermissions.hasPermission(SystemPermission.Type.ADMINISTER); boolean isAdmin = systemPermissions.hasPermission(SystemPermission.Type.ADMINISTER);
// Get the directory // Get the directory
Directory<String, User> userDirectory = userContext.getUserDirectory(); Directory<User> userDirectory = userContext.getUserDirectory();
// Filter users, if requested // Filter users, if requested
Collection<String> userIdentifiers = userDirectory.getIdentifiers(); Collection<String> userIdentifiers = userDirectory.getIdentifiers();
if (!isAdmin && permissions != null) { if (!isAdmin && permissions != null) {
ObjectPermissionSet<String> userPermissions = self.getUserPermissions(); ObjectPermissionSet userPermissions = self.getUserPermissions();
userIdentifiers = userPermissions.getAccessibleObjects(permissions, userIdentifiers); userIdentifiers = userPermissions.getAccessibleObjects(permissions, userIdentifiers);
} }
@@ -217,7 +217,7 @@ public class UserRESTService {
UserContext userContext = authenticationService.getUserContext(authToken); UserContext userContext = authenticationService.getUserContext(authToken);
// Get the directory // Get the directory
Directory<String, User> userDirectory = userContext.getUserDirectory(); Directory<User> userDirectory = userContext.getUserDirectory();
// Randomly set the password if it wasn't provided // Randomly set the password if it wasn't provided
if (user.getPassword() == null) if (user.getPassword() == null)
@@ -256,7 +256,7 @@ public class UserRESTService {
UserContext userContext = authenticationService.getUserContext(authToken); UserContext userContext = authenticationService.getUserContext(authToken);
// Get the directory // Get the directory
Directory<String, User> userDirectory = userContext.getUserDirectory(); Directory<User> userDirectory = userContext.getUserDirectory();
// Validate data and path are sane // Validate data and path are sane
if (!user.getUsername().equals(username)) if (!user.getUsername().equals(username))
@@ -298,7 +298,7 @@ public class UserRESTService {
UserContext userContext = authenticationService.getUserContext(authToken); UserContext userContext = authenticationService.getUserContext(authToken);
// Get the directory // Get the directory
Directory<String, User> userDirectory = userContext.getUserDirectory(); Directory<User> userDirectory = userContext.getUserDirectory();
// Get the user // Get the user
User existingUser = userDirectory.get(username); User existingUser = userDirectory.get(username);
@@ -338,7 +338,7 @@ public class UserRESTService {
User user; User user;
// If username is own username, just use self - might not have query permissions // If username is own username, just use self - might not have query permissions
if (userContext.self().getUsername().equals(username)) if (userContext.self().getIdentifier().equals(username))
user = userContext.self(); user = userContext.self();
// If not self, query corresponding user from directory // If not self, query corresponding user from directory
@@ -430,10 +430,10 @@ public class UserRESTService {
throw new GuacamoleResourceNotFoundException("No such user: \"" + username + "\""); throw new GuacamoleResourceNotFoundException("No such user: \"" + username + "\"");
// Permission patches for all types of permissions // Permission patches for all types of permissions
PermissionSetPatch<ObjectPermission<String>> connectionPermissionPatch = new PermissionSetPatch<ObjectPermission<String>>(); PermissionSetPatch<ObjectPermission> connectionPermissionPatch = new PermissionSetPatch<ObjectPermission>();
PermissionSetPatch<ObjectPermission<String>> connectionGroupPermissionPatch = new PermissionSetPatch<ObjectPermission<String>>(); PermissionSetPatch<ObjectPermission> connectionGroupPermissionPatch = new PermissionSetPatch<ObjectPermission>();
PermissionSetPatch<ObjectPermission<String>> userPermissionPatch = new PermissionSetPatch<ObjectPermission<String>>(); PermissionSetPatch<ObjectPermission> userPermissionPatch = new PermissionSetPatch<ObjectPermission>();
PermissionSetPatch<SystemPermission> systemPermissionPatch = new PermissionSetPatch<SystemPermission>(); PermissionSetPatch<SystemPermission> systemPermissionPatch = new PermissionSetPatch<SystemPermission>();
// Apply all patch operations individually // Apply all patch operations individually
for (APIPatch<String> patch : patches) { for (APIPatch<String> patch : patches) {
@@ -448,7 +448,7 @@ public class UserRESTService {
ObjectPermission.Type type = ObjectPermission.Type.valueOf(patch.getValue()); ObjectPermission.Type type = ObjectPermission.Type.valueOf(patch.getValue());
// Create and update corresponding permission // Create and update corresponding permission
ObjectPermission<String> permission = new ObjectPermission<String>(type, identifier); ObjectPermission permission = new ObjectPermission(type, identifier);
updatePermissionSet(patch.getOp(), connectionPermissionPatch, permission); updatePermissionSet(patch.getOp(), connectionPermissionPatch, permission);
} }
@@ -461,7 +461,7 @@ public class UserRESTService {
ObjectPermission.Type type = ObjectPermission.Type.valueOf(patch.getValue()); ObjectPermission.Type type = ObjectPermission.Type.valueOf(patch.getValue());
// Create and update corresponding permission // Create and update corresponding permission
ObjectPermission<String> permission = new ObjectPermission<String>(type, identifier); ObjectPermission permission = new ObjectPermission(type, identifier);
updatePermissionSet(patch.getOp(), connectionGroupPermissionPatch, permission); updatePermissionSet(patch.getOp(), connectionGroupPermissionPatch, permission);
} }
@@ -474,7 +474,7 @@ public class UserRESTService {
ObjectPermission.Type type = ObjectPermission.Type.valueOf(patch.getValue()); ObjectPermission.Type type = ObjectPermission.Type.valueOf(patch.getValue());
// Create and update corresponding permission // Create and update corresponding permission
ObjectPermission<String> permission = new ObjectPermission<String>(type, identifier); ObjectPermission permission = new ObjectPermission(type, identifier);
updatePermissionSet(patch.getOp(), userPermissionPatch, permission); updatePermissionSet(patch.getOp(), userPermissionPatch, permission);
} }