mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +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;
|
||||
|
||||
@Inject
|
||||
private PermissionCheckService permissionCheckUtility;
|
||||
private PermissionCheckService permissionCheckService;
|
||||
|
||||
@Inject
|
||||
private ProviderService providerUtility;
|
||||
private ProviderService providerService;
|
||||
|
||||
@Inject
|
||||
private ConnectionMapper connectionDAO;
|
||||
@@ -97,15 +97,15 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
||||
@Transactional
|
||||
@Override
|
||||
public Connection get(String identifier) throws GuacamoleException {
|
||||
permissionCheckUtility.verifyConnectionReadAccess(this.user_id, identifier);
|
||||
return providerUtility.getExistingMySQLConnection(identifier);
|
||||
permissionCheckService.verifyConnectionReadAccess(this.user_id, identifier);
|
||||
return providerService.getExistingMySQLConnection(identifier);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public Set<String> getIdentifiers() throws GuacamoleException {
|
||||
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) {
|
||||
connectionNameSet.add(mySQLConnection.getIdentifier());
|
||||
}
|
||||
@@ -115,9 +115,9 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
||||
@Transactional
|
||||
@Override
|
||||
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());
|
||||
|
||||
updateConfigurationValues(mySQLConnection);
|
||||
@@ -206,9 +206,9 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
||||
@Transactional
|
||||
@Override
|
||||
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());
|
||||
|
||||
updateConfigurationValues(mySQLConnection);
|
||||
@@ -217,9 +217,9 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
||||
@Transactional
|
||||
@Override
|
||||
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
|
||||
ConnectionParameterExample connectionParameterExample = new ConnectionParameterExample();
|
||||
|
@@ -68,13 +68,13 @@ public class MySQLConnection implements Connection {
|
||||
private ConnectionParameterMapper connectionParameterDAO;
|
||||
|
||||
@Inject
|
||||
private ProviderService providerUtility;
|
||||
private ProviderService providerService;
|
||||
|
||||
@Inject
|
||||
private ActiveConnectionSet activeConnectionSet;
|
||||
|
||||
@Inject
|
||||
private ConfigurationTranslationService configurationTranslationUtility;
|
||||
private ConfigurationTranslationService configurationTranslationService;
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
ConfiguredGuacamoleSocket configuredSocket = new ConfiguredGuacamoleSocket(inetSocket, configuration);
|
||||
|
||||
MySQLGuacamoleSocket mySQLSocket = providerUtility.getMySQLGuacamoleSocket(configuredSocket, getConnectionID());
|
||||
MySQLGuacamoleSocket mySQLSocket = providerService.getMySQLGuacamoleSocket(configuredSocket, getConnectionID());
|
||||
|
||||
// mark this connection as active
|
||||
activeConnectionSet.add(getConnectionID());
|
||||
@@ -216,6 +216,6 @@ public class MySQLConnection implements Connection {
|
||||
|
||||
@Override
|
||||
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.
|
||||
*/
|
||||
@Inject
|
||||
private ProviderService providerUtility;
|
||||
private ProviderService providerService;
|
||||
|
||||
/**
|
||||
* Initialize this MySQLConnectionRecord with the database record it
|
||||
@@ -100,12 +100,12 @@ public class MySQLConnectionRecord implements ConnectionRecord {
|
||||
|
||||
@Override
|
||||
public User getUser() {
|
||||
return providerUtility.getExistingMySQLUser(connectionHistory.getUser_id());
|
||||
return providerService.getExistingMySQLUser(connectionHistory.getUser_id());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection() {
|
||||
return providerUtility.getExistingMySQLConnection(connectionHistory.getConnection_id());
|
||||
return providerService.getExistingMySQLConnection(connectionHistory.getConnection_id());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -63,19 +63,19 @@ public class MySQLUser extends AbstractUser {
|
||||
* Service for encrypting passwords.
|
||||
*/
|
||||
@Inject
|
||||
private PasswordEncryptionService passwordUtility;
|
||||
private PasswordEncryptionService passwordService;
|
||||
|
||||
/**
|
||||
* Service for generating random salts.
|
||||
*/
|
||||
@Inject
|
||||
private SaltService saltUtility;
|
||||
private SaltService saltService;
|
||||
|
||||
/**
|
||||
* Service for checking permissions.
|
||||
*/
|
||||
@Inject
|
||||
private PermissionCheckService permissionCheckUtility;
|
||||
private PermissionCheckService permissionCheckService;
|
||||
|
||||
/**
|
||||
* The set of current permissions a user has.
|
||||
@@ -132,7 +132,7 @@ public class MySQLUser extends AbstractUser {
|
||||
setUsername(user.getUsername());
|
||||
|
||||
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
|
||||
if (getPassword() != null) {
|
||||
byte[] salt = saltUtility.generateSalt();
|
||||
byte[] salt = saltService.generateSalt();
|
||||
user.setPassword_salt(salt);
|
||||
user.setPassword_hash(
|
||||
passwordUtility.createPasswordHash(getPassword(), salt));
|
||||
passwordService.createPasswordHash(getPassword(), salt));
|
||||
}
|
||||
|
||||
return user;
|
||||
|
@@ -120,29 +120,29 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
private SystemPermissionMapper systemPermissionDAO;
|
||||
|
||||
/**
|
||||
* Utility class for checking various permissions, which will be injected.
|
||||
* Service for checking various permissions, which will be injected.
|
||||
*/
|
||||
@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.
|
||||
*/
|
||||
@Inject
|
||||
private ProviderService providerUtility;
|
||||
private ProviderService providerService;
|
||||
|
||||
/**
|
||||
* Service for encrypting passwords.
|
||||
*/
|
||||
@Inject
|
||||
private PasswordEncryptionService passwordUtility;
|
||||
private PasswordEncryptionService passwordService;
|
||||
|
||||
/**
|
||||
* Service for generating random salts.
|
||||
*/
|
||||
@Inject
|
||||
private SaltService saltUtility;
|
||||
private SaltService saltService;
|
||||
|
||||
/**
|
||||
* Set the user for this directory.
|
||||
@@ -158,8 +158,8 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
@Override
|
||||
public net.sourceforge.guacamole.net.auth.User get(String identifier)
|
||||
throws GuacamoleException {
|
||||
permissionCheckUtility.verifyUserReadAccess(this.user_id, identifier);
|
||||
return providerUtility.getExistingMySQLUser(identifier);
|
||||
permissionCheckService.verifyUserReadAccess(this.user_id, identifier);
|
||||
return providerService.getExistingMySQLUser(identifier);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -167,7 +167,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
public Set<String> getIdentifiers() throws GuacamoleException {
|
||||
|
||||
// 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
|
||||
Set<String> userNameSet = new HashSet<String>();
|
||||
@@ -183,7 +183,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
throws GuacamoleException {
|
||||
|
||||
// Verify current user has permission to create users
|
||||
permissionCheckUtility.verifyCreateUserPermission(this.user_id);
|
||||
permissionCheckService.verifyCreateUserPermission(this.user_id);
|
||||
Preconditions.checkNotNull(object);
|
||||
|
||||
// Create user in database
|
||||
@@ -192,10 +192,10 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
|
||||
// Set password if specified
|
||||
if (object.getPassword() != null) {
|
||||
byte[] salt = saltUtility.generateSalt();
|
||||
byte[] salt = saltService.generateSalt();
|
||||
user.setPassword_salt(salt);
|
||||
user.setPassword_hash(
|
||||
passwordUtility.createPasswordHash(object.getPassword(), salt));
|
||||
passwordService.createPasswordHash(object.getPassword(), salt));
|
||||
}
|
||||
|
||||
userDAO.insert(user);
|
||||
@@ -315,7 +315,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
|
||||
// Get set of administerable users
|
||||
Set<Integer> administerableUsers =
|
||||
permissionCheckUtility.getAdministerableUserIDs(this.user_id);
|
||||
permissionCheckService.getAdministerableUserIDs(this.user_id);
|
||||
|
||||
// Get list of usernames for all given user permissions.
|
||||
List<String> usernames = new ArrayList<String>();
|
||||
@@ -377,7 +377,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
|
||||
// Get set of administerable users
|
||||
Set<Integer> administerableUsers =
|
||||
permissionCheckUtility.getAdministerableUserIDs(this.user_id);
|
||||
permissionCheckService.getAdministerableUserIDs(this.user_id);
|
||||
|
||||
// Get list of usernames for all given user permissions.
|
||||
List<String> usernames = new ArrayList<String>();
|
||||
@@ -443,7 +443,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
|
||||
// Get adminsterable connection identifiers
|
||||
Set<Integer> administerableConnections =
|
||||
permissionCheckUtility.getAdministerableConnectionIDs(this.user_id);
|
||||
permissionCheckService.getAdministerableConnectionIDs(this.user_id);
|
||||
|
||||
// Build list of affected connection names from the permissions given
|
||||
List<String> connectionNames = new ArrayList<String>();
|
||||
@@ -507,7 +507,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
|
||||
// Get set of administerable users
|
||||
Set<Integer> administerableConnections =
|
||||
permissionCheckUtility.getAdministerableConnectionIDs(this.user_id);
|
||||
permissionCheckService.getAdministerableConnectionIDs(this.user_id);
|
||||
|
||||
// Get list of identifiers for all given user permissions.
|
||||
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.");
|
||||
|
||||
// Validate permission to update this user is granted
|
||||
permissionCheckUtility.verifyUserUpdateAccess(this.user_id,
|
||||
permissionCheckService.verifyUserUpdateAccess(this.user_id,
|
||||
object.getUsername());
|
||||
|
||||
// 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 {
|
||||
|
||||
// Validate current user has permission to remove the specified user
|
||||
permissionCheckUtility.verifyUserDeleteAccess(this.user_id,
|
||||
permissionCheckService.verifyUserDeleteAccess(this.user_id,
|
||||
identifier);
|
||||
|
||||
// Get specified user
|
||||
MySQLUser mySQLUser = providerUtility.getExistingMySQLUser(identifier);
|
||||
MySQLUser mySQLUser = providerService.getExistingMySQLUser(identifier);
|
||||
|
||||
// Delete all the user permissions in the database
|
||||
deleteAllPermissions(mySQLUser.getUserID());
|
||||
|
Reference in New Issue
Block a user