mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Ticket #269: Rename service variables from *Utility to *Service.
This commit is contained in:
@@ -71,10 +71,10 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
|||||||
private int user_id;
|
private int user_id;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private PermissionCheckService permissionCheckUtility;
|
private PermissionCheckService permissionCheckService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ProviderService providerUtility;
|
private ProviderService providerService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ConnectionMapper connectionDAO;
|
private ConnectionMapper connectionDAO;
|
||||||
@@ -97,15 +97,15 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Connection get(String identifier) throws GuacamoleException {
|
public Connection get(String identifier) throws GuacamoleException {
|
||||||
permissionCheckUtility.verifyConnectionReadAccess(this.user_id, identifier);
|
permissionCheckService.verifyConnectionReadAccess(this.user_id, identifier);
|
||||||
return providerUtility.getExistingMySQLConnection(identifier);
|
return providerService.getExistingMySQLConnection(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getIdentifiers() throws GuacamoleException {
|
public Set<String> getIdentifiers() throws GuacamoleException {
|
||||||
Set<String> connectionNameSet = new HashSet<String>();
|
Set<String> connectionNameSet = new HashSet<String>();
|
||||||
Set<MySQLConnection> connections = permissionCheckUtility.getReadableConnections(this.user_id);
|
Set<MySQLConnection> connections = permissionCheckService.getReadableConnections(this.user_id);
|
||||||
for(MySQLConnection mySQLConnection : connections) {
|
for(MySQLConnection mySQLConnection : connections) {
|
||||||
connectionNameSet.add(mySQLConnection.getIdentifier());
|
connectionNameSet.add(mySQLConnection.getIdentifier());
|
||||||
}
|
}
|
||||||
@@ -115,9 +115,9 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void add(Connection object) throws GuacamoleException {
|
public void add(Connection object) throws GuacamoleException {
|
||||||
permissionCheckUtility.verifyCreateConnectionPermission(this.user_id);
|
permissionCheckService.verifyCreateConnectionPermission(this.user_id);
|
||||||
|
|
||||||
MySQLConnection mySQLConnection = providerUtility.getNewMySQLConnection(object);
|
MySQLConnection mySQLConnection = providerService.getNewMySQLConnection(object);
|
||||||
connectionDAO.insert(mySQLConnection.getConnection());
|
connectionDAO.insert(mySQLConnection.getConnection());
|
||||||
|
|
||||||
updateConfigurationValues(mySQLConnection);
|
updateConfigurationValues(mySQLConnection);
|
||||||
@@ -206,9 +206,9 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void update(Connection object) throws GuacamoleException {
|
public void update(Connection object) throws GuacamoleException {
|
||||||
permissionCheckUtility.verifyConnectionUpdateAccess(this.user_id, object.getIdentifier());
|
permissionCheckService.verifyConnectionUpdateAccess(this.user_id, object.getIdentifier());
|
||||||
|
|
||||||
MySQLConnection mySQLConnection = providerUtility.getExistingMySQLConnection(object);
|
MySQLConnection mySQLConnection = providerService.getExistingMySQLConnection(object);
|
||||||
connectionDAO.updateByPrimaryKey(mySQLConnection.getConnection());
|
connectionDAO.updateByPrimaryKey(mySQLConnection.getConnection());
|
||||||
|
|
||||||
updateConfigurationValues(mySQLConnection);
|
updateConfigurationValues(mySQLConnection);
|
||||||
@@ -217,9 +217,9 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void remove(String identifier) throws GuacamoleException {
|
public void remove(String identifier) throws GuacamoleException {
|
||||||
permissionCheckUtility.verifyConnectionDeleteAccess(this.user_id, identifier);
|
permissionCheckService.verifyConnectionDeleteAccess(this.user_id, identifier);
|
||||||
|
|
||||||
MySQLConnection mySQLConnection = providerUtility.getExistingMySQLConnection(identifier);
|
MySQLConnection mySQLConnection = providerService.getExistingMySQLConnection(identifier);
|
||||||
|
|
||||||
// delete all configuration values
|
// delete all configuration values
|
||||||
ConnectionParameterExample connectionParameterExample = new ConnectionParameterExample();
|
ConnectionParameterExample connectionParameterExample = new ConnectionParameterExample();
|
||||||
|
@@ -68,13 +68,13 @@ public class MySQLConnection implements Connection {
|
|||||||
private ConnectionParameterMapper connectionParameterDAO;
|
private ConnectionParameterMapper connectionParameterDAO;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ProviderService providerUtility;
|
private ProviderService providerService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ActiveConnectionSet activeConnectionSet;
|
private ActiveConnectionSet activeConnectionSet;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ConfigurationTranslationService configurationTranslationUtility;
|
private ConfigurationTranslationService configurationTranslationService;
|
||||||
|
|
||||||
private net.sourceforge.guacamole.net.auth.mysql.model.Connection connection;
|
private net.sourceforge.guacamole.net.auth.mysql.model.Connection connection;
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ public class MySQLConnection implements Connection {
|
|||||||
|
|
||||||
List<ConnectionParameter> connectionParameters = connectionParameterDAO.selectByExample(connectionParameterExample);
|
List<ConnectionParameter> connectionParameters = connectionParameterDAO.selectByExample(connectionParameterExample);
|
||||||
|
|
||||||
configuration = configurationTranslationUtility.getConfiguration(connection.getProtocol(), connectionParameters);
|
configuration = configurationTranslationService.getConfiguration(connection.getProtocol(), connectionParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,7 +187,7 @@ public class MySQLConnection implements Connection {
|
|||||||
InetGuacamoleSocket inetSocket = new InetGuacamoleSocket(host, port);
|
InetGuacamoleSocket inetSocket = new InetGuacamoleSocket(host, port);
|
||||||
ConfiguredGuacamoleSocket configuredSocket = new ConfiguredGuacamoleSocket(inetSocket, configuration);
|
ConfiguredGuacamoleSocket configuredSocket = new ConfiguredGuacamoleSocket(inetSocket, configuration);
|
||||||
|
|
||||||
MySQLGuacamoleSocket mySQLSocket = providerUtility.getMySQLGuacamoleSocket(configuredSocket, getConnectionID());
|
MySQLGuacamoleSocket mySQLSocket = providerService.getMySQLGuacamoleSocket(configuredSocket, getConnectionID());
|
||||||
|
|
||||||
// mark this connection as active
|
// mark this connection as active
|
||||||
activeConnectionSet.add(getConnectionID());
|
activeConnectionSet.add(getConnectionID());
|
||||||
@@ -216,6 +216,6 @@ public class MySQLConnection implements Connection {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends ConnectionRecord> getHistory() throws GuacamoleException {
|
public List<? extends ConnectionRecord> getHistory() throws GuacamoleException {
|
||||||
return providerUtility.getExistingMySQLConnectionRecords(connection.getConnection_id());
|
return providerService.getExistingMySQLConnectionRecords(connection.getConnection_id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,7 @@ public class MySQLConnectionRecord implements ConnectionRecord {
|
|||||||
* Service for creating and retrieving objects.
|
* Service for creating and retrieving objects.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private ProviderService providerUtility;
|
private ProviderService providerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize this MySQLConnectionRecord with the database record it
|
* Initialize this MySQLConnectionRecord with the database record it
|
||||||
@@ -100,12 +100,12 @@ public class MySQLConnectionRecord implements ConnectionRecord {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getUser() {
|
public User getUser() {
|
||||||
return providerUtility.getExistingMySQLUser(connectionHistory.getUser_id());
|
return providerService.getExistingMySQLUser(connectionHistory.getUser_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Connection getConnection() {
|
public Connection getConnection() {
|
||||||
return providerUtility.getExistingMySQLConnection(connectionHistory.getConnection_id());
|
return providerService.getExistingMySQLConnection(connectionHistory.getConnection_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -63,19 +63,19 @@ public class MySQLUser extends AbstractUser {
|
|||||||
* Service for encrypting passwords.
|
* Service for encrypting passwords.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private PasswordEncryptionService passwordUtility;
|
private PasswordEncryptionService passwordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for generating random salts.
|
* Service for generating random salts.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private SaltService saltUtility;
|
private SaltService saltService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for checking permissions.
|
* Service for checking permissions.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private PermissionCheckService permissionCheckUtility;
|
private PermissionCheckService permissionCheckService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The set of current permissions a user has.
|
* The set of current permissions a user has.
|
||||||
@@ -132,7 +132,7 @@ public class MySQLUser extends AbstractUser {
|
|||||||
setUsername(user.getUsername());
|
setUsername(user.getUsername());
|
||||||
|
|
||||||
permissions.addAll(
|
permissions.addAll(
|
||||||
permissionCheckUtility.getAllPermissions(user.getUser_id()));
|
permissionCheckService.getAllPermissions(user.getUser_id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -229,10 +229,10 @@ public class MySQLUser extends AbstractUser {
|
|||||||
|
|
||||||
// Set password if specified
|
// Set password if specified
|
||||||
if (getPassword() != null) {
|
if (getPassword() != null) {
|
||||||
byte[] salt = saltUtility.generateSalt();
|
byte[] salt = saltService.generateSalt();
|
||||||
user.setPassword_salt(salt);
|
user.setPassword_salt(salt);
|
||||||
user.setPassword_hash(
|
user.setPassword_hash(
|
||||||
passwordUtility.createPasswordHash(getPassword(), salt));
|
passwordService.createPasswordHash(getPassword(), salt));
|
||||||
}
|
}
|
||||||
|
|
||||||
return user;
|
return user;
|
||||||
|
@@ -120,29 +120,29 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
|||||||
private SystemPermissionMapper systemPermissionDAO;
|
private SystemPermissionMapper systemPermissionDAO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class for checking various permissions, which will be injected.
|
* Service for checking various permissions, which will be injected.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private PermissionCheckService permissionCheckUtility;
|
private PermissionCheckService permissionCheckService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class that provides convenient access to object creation and
|
* Service providing convenient access to object creation and
|
||||||
* retrieval functions.
|
* retrieval functions.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private ProviderService providerUtility;
|
private ProviderService providerService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for encrypting passwords.
|
* Service for encrypting passwords.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private PasswordEncryptionService passwordUtility;
|
private PasswordEncryptionService passwordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service for generating random salts.
|
* Service for generating random salts.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private SaltService saltUtility;
|
private SaltService saltService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the user for this directory.
|
* Set the user for this directory.
|
||||||
@@ -158,8 +158,8 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
|||||||
@Override
|
@Override
|
||||||
public net.sourceforge.guacamole.net.auth.User get(String identifier)
|
public net.sourceforge.guacamole.net.auth.User get(String identifier)
|
||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
permissionCheckUtility.verifyUserReadAccess(this.user_id, identifier);
|
permissionCheckService.verifyUserReadAccess(this.user_id, identifier);
|
||||||
return providerUtility.getExistingMySQLUser(identifier);
|
return providerService.getExistingMySQLUser(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -167,7 +167,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
|||||||
public Set<String> getIdentifiers() throws GuacamoleException {
|
public Set<String> getIdentifiers() throws GuacamoleException {
|
||||||
|
|
||||||
// Get set of all readable users
|
// Get set of all readable users
|
||||||
Set<MySQLUser> users = permissionCheckUtility.getReadableUsers(this.user_id);
|
Set<MySQLUser> users = permissionCheckService.getReadableUsers(this.user_id);
|
||||||
|
|
||||||
// Build set of usernames of readable users
|
// Build set of usernames of readable users
|
||||||
Set<String> userNameSet = new HashSet<String>();
|
Set<String> userNameSet = new HashSet<String>();
|
||||||
@@ -183,7 +183,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
|||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
|
|
||||||
// Verify current user has permission to create users
|
// Verify current user has permission to create users
|
||||||
permissionCheckUtility.verifyCreateUserPermission(this.user_id);
|
permissionCheckService.verifyCreateUserPermission(this.user_id);
|
||||||
Preconditions.checkNotNull(object);
|
Preconditions.checkNotNull(object);
|
||||||
|
|
||||||
// Create user in database
|
// Create user in database
|
||||||
@@ -192,10 +192,10 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
|||||||
|
|
||||||
// Set password if specified
|
// Set password if specified
|
||||||
if (object.getPassword() != null) {
|
if (object.getPassword() != null) {
|
||||||
byte[] salt = saltUtility.generateSalt();
|
byte[] salt = saltService.generateSalt();
|
||||||
user.setPassword_salt(salt);
|
user.setPassword_salt(salt);
|
||||||
user.setPassword_hash(
|
user.setPassword_hash(
|
||||||
passwordUtility.createPasswordHash(object.getPassword(), salt));
|
passwordService.createPasswordHash(object.getPassword(), salt));
|
||||||
}
|
}
|
||||||
|
|
||||||
userDAO.insert(user);
|
userDAO.insert(user);
|
||||||
@@ -315,7 +315,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
|||||||
|
|
||||||
// Get set of administerable users
|
// Get set of administerable users
|
||||||
Set<Integer> administerableUsers =
|
Set<Integer> administerableUsers =
|
||||||
permissionCheckUtility.getAdministerableUserIDs(this.user_id);
|
permissionCheckService.getAdministerableUserIDs(this.user_id);
|
||||||
|
|
||||||
// Get list of usernames for all given user permissions.
|
// Get list of usernames for all given user permissions.
|
||||||
List<String> usernames = new ArrayList<String>();
|
List<String> usernames = new ArrayList<String>();
|
||||||
@@ -377,7 +377,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
|||||||
|
|
||||||
// Get set of administerable users
|
// Get set of administerable users
|
||||||
Set<Integer> administerableUsers =
|
Set<Integer> administerableUsers =
|
||||||
permissionCheckUtility.getAdministerableUserIDs(this.user_id);
|
permissionCheckService.getAdministerableUserIDs(this.user_id);
|
||||||
|
|
||||||
// Get list of usernames for all given user permissions.
|
// Get list of usernames for all given user permissions.
|
||||||
List<String> usernames = new ArrayList<String>();
|
List<String> usernames = new ArrayList<String>();
|
||||||
@@ -443,7 +443,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
|||||||
|
|
||||||
// Get adminsterable connection identifiers
|
// Get adminsterable connection identifiers
|
||||||
Set<Integer> administerableConnections =
|
Set<Integer> administerableConnections =
|
||||||
permissionCheckUtility.getAdministerableConnectionIDs(this.user_id);
|
permissionCheckService.getAdministerableConnectionIDs(this.user_id);
|
||||||
|
|
||||||
// Build list of affected connection names from the permissions given
|
// Build list of affected connection names from the permissions given
|
||||||
List<String> connectionNames = new ArrayList<String>();
|
List<String> connectionNames = new ArrayList<String>();
|
||||||
@@ -507,7 +507,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
|||||||
|
|
||||||
// Get set of administerable users
|
// Get set of administerable users
|
||||||
Set<Integer> administerableConnections =
|
Set<Integer> administerableConnections =
|
||||||
permissionCheckUtility.getAdministerableConnectionIDs(this.user_id);
|
permissionCheckService.getAdministerableConnectionIDs(this.user_id);
|
||||||
|
|
||||||
// Get list of identifiers for all given user permissions.
|
// Get list of identifiers for all given user permissions.
|
||||||
List<String> identifiers = new ArrayList<String>();
|
List<String> identifiers = new ArrayList<String>();
|
||||||
@@ -691,7 +691,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
|||||||
throw new GuacamoleException("User not from database.");
|
throw new GuacamoleException("User not from database.");
|
||||||
|
|
||||||
// Validate permission to update this user is granted
|
// Validate permission to update this user is granted
|
||||||
permissionCheckUtility.verifyUserUpdateAccess(this.user_id,
|
permissionCheckService.verifyUserUpdateAccess(this.user_id,
|
||||||
object.getUsername());
|
object.getUsername());
|
||||||
|
|
||||||
// Update the user in the database
|
// Update the user in the database
|
||||||
@@ -713,11 +713,11 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
|||||||
public void remove(String identifier) throws GuacamoleException {
|
public void remove(String identifier) throws GuacamoleException {
|
||||||
|
|
||||||
// Validate current user has permission to remove the specified user
|
// Validate current user has permission to remove the specified user
|
||||||
permissionCheckUtility.verifyUserDeleteAccess(this.user_id,
|
permissionCheckService.verifyUserDeleteAccess(this.user_id,
|
||||||
identifier);
|
identifier);
|
||||||
|
|
||||||
// Get specified user
|
// Get specified user
|
||||||
MySQLUser mySQLUser = providerUtility.getExistingMySQLUser(identifier);
|
MySQLUser mySQLUser = providerService.getExistingMySQLUser(identifier);
|
||||||
|
|
||||||
// Delete all the user permissions in the database
|
// Delete all the user permissions in the database
|
||||||
deleteAllPermissions(mySQLUser.getUserID());
|
deleteAllPermissions(mySQLUser.getUserID());
|
||||||
|
Reference in New Issue
Block a user