mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
Fix style issues.
This commit is contained in:
@@ -38,7 +38,6 @@ package net.sourceforge.guacamole.net.auth.mysql;
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import net.sourceforge.guacamole.GuacamoleClientException;
|
||||
import net.sourceforge.guacamole.GuacamoleException;
|
||||
@@ -133,17 +132,17 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
||||
String identifier = object.getIdentifier().trim();
|
||||
if(identifier.isEmpty())
|
||||
throw new GuacamoleClientException("The connection identifier cannot be blank.");
|
||||
|
||||
|
||||
// Verify permission to create
|
||||
permissionCheckService.verifySystemAccess(this.user_id,
|
||||
MySQLConstants.SYSTEM_CONNECTION_CREATE);
|
||||
|
||||
// Verify that no connection already exists with this identifier.
|
||||
MySQLConnection previousConnection =
|
||||
MySQLConnection previousConnection =
|
||||
connectionService.retrieveConnection(identifier, user_id);
|
||||
if(previousConnection != null)
|
||||
throw new GuacamoleClientException("That connection identifier is already in use.");
|
||||
|
||||
|
||||
// Create connection
|
||||
MySQLConnection connection = connectionService.createConnection(
|
||||
identifier, object.getConfiguration().getProtocol(),
|
||||
|
@@ -485,6 +485,8 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
* @param user_id The ID of the user whose permissions should be updated.
|
||||
* @param permissions The new system permissions that the given user should
|
||||
* have when this operation completes.
|
||||
* @throws GuacamoleException If permission to administer system permissions
|
||||
* is denied.
|
||||
*/
|
||||
private void createSystemPermissions(int user_id,
|
||||
Collection<SystemPermission> permissions) throws GuacamoleException {
|
||||
@@ -499,7 +501,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
|
||||
// Insert all requested permissions
|
||||
for (SystemPermission permission : permissions) {
|
||||
|
||||
|
||||
// Insert permission
|
||||
SystemPermissionKey newSystemPermission = new SystemPermissionKey();
|
||||
newSystemPermission.setUser_id(user_id);
|
||||
@@ -531,7 +533,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
// Prevent self-de-adminifying
|
||||
if (user_id == this.user_id)
|
||||
throw new GuacamoleClientException("Removing your own administrative permissions is not allowed.");
|
||||
|
||||
|
||||
// Build list of requested system permissions
|
||||
List<String> systemPermissionTypes = new ArrayList<String>();
|
||||
for (SystemPermission permission : permissions)
|
||||
@@ -585,7 +587,7 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol
|
||||
// Prevent self-deletion
|
||||
if (user.getUserID() == this.user_id)
|
||||
throw new GuacamoleClientException("Deleting your own user is not allowed.");
|
||||
|
||||
|
||||
// Validate current user has permission to remove the specified user
|
||||
permissionCheckService.verifyUserAccess(this.user_id,
|
||||
user.getUserID(),
|
||||
|
@@ -291,12 +291,12 @@ public class ConnectionService {
|
||||
|
||||
// We want to return the newest records first
|
||||
example.setOrderByClause("start_date DESC");
|
||||
|
||||
|
||||
// Set the maximum number of history records returned to 100
|
||||
RowBounds rowBounds = new RowBounds(0, 100);
|
||||
|
||||
// Retrieve all connection history entries
|
||||
List<ConnectionHistory> connectionHistories =
|
||||
List<ConnectionHistory> connectionHistories =
|
||||
connectionHistoryDAO.selectByExampleWithRowbounds(example, rowBounds);
|
||||
|
||||
// Convert history entries to connection records
|
||||
@@ -412,10 +412,10 @@ public class ConnectionService {
|
||||
connectionDAO.updateByPrimaryKeySelective(connection);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the names of all the connections defined in the system.
|
||||
*
|
||||
*
|
||||
* @return A Set of names of all the connections defined in the system.
|
||||
*/
|
||||
public Set<String> getAllConnectionNames() {
|
||||
@@ -428,19 +428,19 @@ public class ConnectionService {
|
||||
connectionDAO.selectByExample(new ConnectionExample());
|
||||
for (Connection connection : connections)
|
||||
names.add(connection.getConnection_name());
|
||||
|
||||
|
||||
return names;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the connection IDs of all the connections defined in the system.
|
||||
*
|
||||
*
|
||||
* @return A list of connection IDs of all the connections defined in the system.
|
||||
*/
|
||||
public List<Integer> getAllConnectionIDs() {
|
||||
|
||||
// Set of all present connection IDs
|
||||
// Set of all present connection IDs
|
||||
List<Integer> connectionIDs = new ArrayList<Integer>();
|
||||
|
||||
// Query all connection IDs
|
||||
@@ -448,7 +448,7 @@ public class ConnectionService {
|
||||
connectionDAO.selectByExample(new ConnectionExample());
|
||||
for (Connection connection : connections)
|
||||
connectionIDs.add(connection.getConnection_id());
|
||||
|
||||
|
||||
return connectionIDs;
|
||||
|
||||
}
|
||||
|
@@ -164,7 +164,7 @@ public class PermissionCheckService {
|
||||
// A system administrator has full access to everything.
|
||||
if(checkSystemAdministratorAccess(userID))
|
||||
return true;
|
||||
|
||||
|
||||
// Check existence of requested permission
|
||||
UserPermissionExample example = new UserPermissionExample();
|
||||
example.createCriteria().andUser_idEqualTo(userID).andAffected_user_idEqualTo(affectedUserID).andPermissionEqualTo(permissionType);
|
||||
@@ -187,7 +187,7 @@ public class PermissionCheckService {
|
||||
// A system administrator has full access to everything.
|
||||
if(checkSystemAdministratorAccess(userID))
|
||||
return true;
|
||||
|
||||
|
||||
// Check existence of requested permission
|
||||
ConnectionPermissionExample example = new ConnectionPermissionExample();
|
||||
example.createCriteria().andUser_idEqualTo(userID).andConnection_idEqualTo(affectedConnectionID).andPermissionEqualTo(permissionType);
|
||||
@@ -207,14 +207,14 @@ public class PermissionCheckService {
|
||||
// A system administrator has full access to everything.
|
||||
if(checkSystemAdministratorAccess(userID))
|
||||
return true;
|
||||
|
||||
|
||||
// Check existence of requested permission
|
||||
SystemPermissionExample example = new SystemPermissionExample();
|
||||
example.createCriteria().andUser_idEqualTo(userID).andPermissionEqualTo(systemPermissionType);
|
||||
return systemPermissionDAO.countByExample(example) > 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether a user has system administrator access to the system.
|
||||
@@ -244,7 +244,7 @@ public class PermissionCheckService {
|
||||
// A system administrator has access to all users.
|
||||
if(checkSystemAdministratorAccess(userID))
|
||||
return userService.getAllUserIDs();
|
||||
|
||||
|
||||
// Query all user permissions for the given user and permission type
|
||||
UserPermissionExample example = new UserPermissionExample();
|
||||
example.createCriteria().andUser_idEqualTo(userID).andPermissionEqualTo(permissionType);
|
||||
@@ -296,7 +296,7 @@ public class PermissionCheckService {
|
||||
/**
|
||||
* Retrieve all existing usernames that the given user has permission to
|
||||
* perform the given operation upon.
|
||||
*
|
||||
*
|
||||
* @param userID The user whose permissions should be checked.
|
||||
* @param permissionType The permission to check.
|
||||
* @return A set of all usernames for which the given user has the given
|
||||
@@ -320,7 +320,7 @@ public class PermissionCheckService {
|
||||
/**
|
||||
* Retrieve all existing usernames that the given user has permission to
|
||||
* perform the given operation upon.
|
||||
*
|
||||
*
|
||||
* @param userID The user whose permissions should be checked.
|
||||
* @param permissionType The permission to check.
|
||||
* @return A set of all usernames for which the given user has the given
|
||||
|
@@ -337,10 +337,10 @@ public class UserService {
|
||||
userDAO.updateByPrimaryKeySelective(user);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the usernames of all the users defined in the system.
|
||||
*
|
||||
*
|
||||
* @return A Set of usernames of all the users defined in the system.
|
||||
*/
|
||||
public Set<String> getAllUsernames() {
|
||||
@@ -353,19 +353,19 @@ public class UserService {
|
||||
userDAO.selectByExample(new UserExample());
|
||||
for (User user : users)
|
||||
usernames.add(user.getUsername());
|
||||
|
||||
|
||||
return usernames;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user IDs of all the users defined in the system.
|
||||
*
|
||||
*
|
||||
* @return A list of user IDs of all the users defined in the system.
|
||||
*/
|
||||
public List<Integer> getAllUserIDs() {
|
||||
|
||||
// Set of all present user IDs
|
||||
// Set of all present user IDs
|
||||
List<Integer> userIDs = new ArrayList<Integer>();
|
||||
|
||||
// Query all user IDs
|
||||
@@ -373,7 +373,7 @@ public class UserService {
|
||||
userDAO.selectByExample(new UserExample());
|
||||
for (User user : users)
|
||||
userIDs.add(user.getUser_id());
|
||||
|
||||
|
||||
return userIDs;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user