GUACAMOLE-96: Merge add protected convenience method for retrieving delegate object.

This commit is contained in:
Nick Couchman
2018-10-05 14:40:22 -04:00
8 changed files with 74 additions and 7 deletions

View File

@@ -41,11 +41,6 @@ public class TOTPUser extends DelegatingUser {
*/ */
public static final String TOTP_KEY_CONFIRMED_ATTRIBUTE_NAME = "guac-totp-key-confirmed"; public static final String TOTP_KEY_CONFIRMED_ATTRIBUTE_NAME = "guac-totp-key-confirmed";
/**
* The User object wrapped by this TOTPUser.
*/
private final User undecorated;
/** /**
* Wraps the given User object, hiding and blocking access to the core * Wraps the given User object, hiding and blocking access to the core
* attributes used by TOTP. * attributes used by TOTP.
@@ -55,7 +50,6 @@ public class TOTPUser extends DelegatingUser {
*/ */
public TOTPUser(User user) { public TOTPUser(User user) {
super(user); super(user);
this.undecorated = user;
} }
/** /**
@@ -65,7 +59,7 @@ public class TOTPUser extends DelegatingUser {
* The wrapped User object. * The wrapped User object.
*/ */
public User getUndecorated() { public User getUndecorated() {
return undecorated; return getDelegateUser();
} }
@Override @Override

View File

@@ -50,6 +50,16 @@ public class DelegatingConnection implements Connection {
this.connection = connection; this.connection = connection;
} }
/**
* Returns the underlying Connection wrapped by this DelegatingConnection.
*
* @return
* The Connection wrapped by this DelegatingConnection.
*/
protected Connection getDelegateConnection() {
return connection;
}
@Override @Override
public String getIdentifier() { public String getIdentifier() {
return connection.getIdentifier(); return connection.getIdentifier();

View File

@@ -47,6 +47,17 @@ public class DelegatingConnectionGroup implements ConnectionGroup {
this.connectionGroup = connectionGroup; this.connectionGroup = connectionGroup;
} }
/**
* Returns the underlying ConnectionGroup wrapped by this
* DelegatingConnectionGroup.
*
* @return
* The ConnectionGroup wrapped by this DelegatingConnectionGroup.
*/
protected ConnectionGroup getDelegateConnectionGroup() {
return connectionGroup;
}
@Override @Override
public String getIdentifier() { public String getIdentifier() {
return connectionGroup.getIdentifier(); return connectionGroup.getIdentifier();

View File

@@ -49,6 +49,16 @@ public class DelegatingDirectory<ObjectType extends Identifiable>
this.directory = directory; this.directory = directory;
} }
/**
* Returns the underlying Directory wrapped by this DelegatingDirectory.
*
* @return
* The Directory wrapped by this DelegatingDirectory.
*/
protected Directory<ObjectType> getDelegateDirectory() {
return directory;
}
@Override @Override
public ObjectType get(String identifier) throws GuacamoleException { public ObjectType get(String identifier) throws GuacamoleException {
return directory.get(identifier); return directory.get(identifier);

View File

@@ -43,6 +43,17 @@ public class DelegatingSharingProfile implements SharingProfile {
this.sharingProfile = sharingProfile; this.sharingProfile = sharingProfile;
} }
/**
* Returns the underlying SharingProfile wrapped by this
* DelegatingSharingProfile.
*
* @return
* The SharingProfile wrapped by this DelegatingSharingProfile.
*/
protected SharingProfile getDelegateSharingProfile() {
return sharingProfile;
}
@Override @Override
public String getIdentifier() { public String getIdentifier() {
return sharingProfile.getIdentifier(); return sharingProfile.getIdentifier();

View File

@@ -48,6 +48,16 @@ public class DelegatingUser implements User {
this.user = user; this.user = user;
} }
/**
* Returns the underlying User wrapped by this DelegatingUser.
*
* @return
* The User wrapped by this DelegatingUser.
*/
protected User getDelegateUser() {
return user;
}
@Override @Override
public String getIdentifier() { public String getIdentifier() {
return user.getIdentifier(); return user.getIdentifier();

View File

@@ -45,6 +45,17 @@ public class DelegatingUserContext implements UserContext {
this.userContext = userContext; this.userContext = userContext;
} }
/**
* Returns the underlying UserContext wrapped by this
* DelegatingUserContext.
*
* @return
* The UserContext wrapped by this DelegatingUserContext.
*/
protected UserContext getDelegateUserContext() {
return userContext;
}
@Override @Override
public User self() { public User self() {
return userContext.self(); return userContext.self();

View File

@@ -46,6 +46,16 @@ public class DelegatingUserGroup implements UserGroup {
this.userGroup = userGroup; this.userGroup = userGroup;
} }
/**
* Returns the underlying UserGroup wrapped by this DelegatingUserGroup.
*
* @return
* The UserGroup wrapped by this DelegatingUserGroup.
*/
protected UserGroup getDelegateUserGroupGroup() {
return userGroup;
}
@Override @Override
public String getIdentifier() { public String getIdentifier() {
return userGroup.getIdentifier(); return userGroup.getIdentifier();