mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-1239: JDBC module should pull case-sensitivity from authentcated user when possible.
This commit is contained in:
@@ -494,7 +494,7 @@ public class ConnectionService extends ModeledChildDirectoryObjectService<Modele
|
|||||||
if (user.isPrivileged() || user.getUser().getEffectivePermissions().getSystemPermissions().hasPermission(SystemPermission.Type.AUDIT))
|
if (user.isPrivileged() || user.getUser().getEffectivePermissions().getSystemPermissions().hasPermission(SystemPermission.Type.AUDIT))
|
||||||
searchResults = connectionRecordMapper.search(identifier,
|
searchResults = connectionRecordMapper.search(identifier,
|
||||||
recordIdentifier, requiredContents, sortPredicates, limit,
|
recordIdentifier, requiredContents, sortPredicates, limit,
|
||||||
environment.getCaseSensitiveUsernames());
|
user.isCaseSensitive());
|
||||||
|
|
||||||
// Otherwise only return explicitly readable history records
|
// Otherwise only return explicitly readable history records
|
||||||
else
|
else
|
||||||
@@ -502,7 +502,7 @@ public class ConnectionService extends ModeledChildDirectoryObjectService<Modele
|
|||||||
user.getUser().getModel(), recordIdentifier,
|
user.getUser().getModel(), recordIdentifier,
|
||||||
requiredContents, sortPredicates, limit,
|
requiredContents, sortPredicates, limit,
|
||||||
user.getEffectiveUserGroups(),
|
user.getEffectiveUserGroups(),
|
||||||
environment.getCaseSensitiveUsernames());
|
user.isCaseSensitive());
|
||||||
|
|
||||||
return getObjectInstances(searchResults);
|
return getObjectInstances(searchResults);
|
||||||
|
|
||||||
|
@@ -479,7 +479,7 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
|
|||||||
try {
|
try {
|
||||||
// This MUST happen before getUUID() is invoked, to ensure the ID driving the UUID exists
|
// This MUST happen before getUUID() is invoked, to ensure the ID driving the UUID exists
|
||||||
connectionRecordMapper.insert(activeConnection.getModel(),
|
connectionRecordMapper.insert(activeConnection.getModel(),
|
||||||
environment.getCaseSensitiveUsernames());
|
activeConnection.getUser().isCaseSensitive());
|
||||||
activeTunnels.put(activeConnection.getUUID().toString(), activeConnection);
|
activeTunnels.put(activeConnection.getUUID().toString(), activeConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -194,7 +194,7 @@ public class ModeledUserContext extends RestrictedObject
|
|||||||
userRecord.setRemoteHost(getCurrentUser().getCredentials().getRemoteAddress());
|
userRecord.setRemoteHost(getCurrentUser().getCredentials().getRemoteAddress());
|
||||||
|
|
||||||
// Insert record representing login
|
// Insert record representing login
|
||||||
userRecordMapper.insert(userRecord, environment.getCaseSensitiveUsernames());
|
userRecordMapper.insert(userRecord, getCurrentUser().isCaseSensitive());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -156,13 +156,13 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
|
|||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private PasswordPolicyService passwordPolicyService;
|
private PasswordPolicyService passwordPolicyService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server environment for retrieving configuration.
|
* The server environment for retrieving configuration.
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private JDBCEnvironment environment;
|
private JDBCEnvironment environment;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ModeledDirectoryObjectMapper<UserModel> getObjectMapper() {
|
protected ModeledDirectoryObjectMapper<UserModel> getObjectMapper() {
|
||||||
return userMapper;
|
return userMapper;
|
||||||
@@ -254,7 +254,7 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
|
|||||||
|
|
||||||
// Do not create duplicate users
|
// Do not create duplicate users
|
||||||
Collection<UserModel> existing = userMapper.select(Collections.singleton(
|
Collection<UserModel> existing = userMapper.select(Collections.singleton(
|
||||||
model.getIdentifier()), environment.getCaseSensitiveUsernames());
|
model.getIdentifier()), user.isCaseSensitive());
|
||||||
if (!existing.isEmpty())
|
if (!existing.isEmpty())
|
||||||
throw new GuacamoleClientException("User \"" + model.getIdentifier() + "\" already exists.");
|
throw new GuacamoleClientException("User \"" + model.getIdentifier() + "\" already exists.");
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
|
|||||||
|
|
||||||
// Check whether such a user is already present
|
// Check whether such a user is already present
|
||||||
UserModel existing = userMapper.selectOne(model.getIdentifier(),
|
UserModel existing = userMapper.selectOne(model.getIdentifier(),
|
||||||
environment.getCaseSensitiveUsernames());
|
user.isCaseSensitive());
|
||||||
if (existing != null) {
|
if (existing != null) {
|
||||||
|
|
||||||
// Do not rename to existing user
|
// Do not rename to existing user
|
||||||
@@ -359,7 +359,7 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
|
|||||||
beforeDelete(user, identifier);
|
beforeDelete(user, identifier);
|
||||||
|
|
||||||
// Delete object
|
// Delete object
|
||||||
userMapper.delete(identifier, environment.getCaseSensitiveUsernames());
|
userMapper.delete(identifier, user.isCaseSensitive());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,7 +401,7 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
|
|||||||
|
|
||||||
// Retrieve corresponding user model, if such a user exists
|
// Retrieve corresponding user model, if such a user exists
|
||||||
UserModel userModel = userMapper.selectOne(username,
|
UserModel userModel = userMapper.selectOne(username,
|
||||||
environment.getCaseSensitiveUsernames());
|
getCaseSensitiveIdentifiers());
|
||||||
if (userModel == null)
|
if (userModel == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -443,7 +443,7 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
|
|||||||
|
|
||||||
// Retrieve corresponding user model, if such a user exists
|
// Retrieve corresponding user model, if such a user exists
|
||||||
UserModel userModel = userMapper.selectOne(authenticatedUser.getIdentifier(),
|
UserModel userModel = userMapper.selectOne(authenticatedUser.getIdentifier(),
|
||||||
environment.getCaseSensitiveUsernames());
|
authenticatedUser.isCaseSensitive());
|
||||||
if (userModel == null)
|
if (userModel == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -642,7 +642,7 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
|
|||||||
if (user.isPrivileged() || user.getUser().getEffectivePermissions().getSystemPermissions().hasPermission(SystemPermission.Type.AUDIT))
|
if (user.isPrivileged() || user.getUser().getEffectivePermissions().getSystemPermissions().hasPermission(SystemPermission.Type.AUDIT))
|
||||||
searchResults = userRecordMapper.search(username, recordIdentifier,
|
searchResults = userRecordMapper.search(username, recordIdentifier,
|
||||||
requiredContents, sortPredicates, limit,
|
requiredContents, sortPredicates, limit,
|
||||||
environment.getCaseSensitiveUsernames());
|
user.isCaseSensitive());
|
||||||
|
|
||||||
// Otherwise only return explicitly readable history records
|
// Otherwise only return explicitly readable history records
|
||||||
else
|
else
|
||||||
@@ -650,7 +650,7 @@ public class UserService extends ModeledDirectoryObjectService<ModeledUser, User
|
|||||||
user.getUser().getModel(), recordIdentifier,
|
user.getUser().getModel(), recordIdentifier,
|
||||||
requiredContents, sortPredicates, limit,
|
requiredContents, sortPredicates, limit,
|
||||||
user.getEffectiveUserGroups(),
|
user.getEffectiveUserGroups(),
|
||||||
environment.getCaseSensitiveUsernames());
|
user.isCaseSensitive());
|
||||||
|
|
||||||
return getObjectInstances(searchResults);
|
return getObjectInstances(searchResults);
|
||||||
|
|
||||||
|
@@ -37,16 +37,10 @@ public class UserGroupMemberUserSet extends RelatedObjectSet<ModeledUserGroup, U
|
|||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
private UserGroupMemberUserMapper userGroupMemberUserMapper;
|
private UserGroupMemberUserMapper userGroupMemberUserMapper;
|
||||||
|
|
||||||
/**
|
|
||||||
* The server environment for retrieving configuration information.
|
|
||||||
*/
|
|
||||||
@Inject
|
|
||||||
private JDBCEnvironment environment;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean getCaseSensitiveIdentifiers() throws GuacamoleException {
|
protected boolean getCaseSensitiveIdentifiers() throws GuacamoleException {
|
||||||
return environment.getCaseSensitiveUsernames();
|
return getCurrentUser().isCaseSensitive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user