mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 13:41:21 +00:00
Ticket #263: Fixed some exceptions.
This commit is contained in:
@@ -173,7 +173,7 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
|||||||
|
|
||||||
// Verify that no connection already exists with this name.
|
// Verify that no connection already exists with this name.
|
||||||
MySQLConnection previousConnection =
|
MySQLConnection previousConnection =
|
||||||
connectionService.retrieveConnection(name, user_id, parentID);
|
connectionService.retrieveConnection(name, parentID, user_id);
|
||||||
if(previousConnection != null)
|
if(previousConnection != null)
|
||||||
throw new GuacamoleClientException("That connection name is already in use.");
|
throw new GuacamoleClientException("That connection name is already in use.");
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ public class ConnectionDirectory implements Directory<String, Connection>{
|
|||||||
|
|
||||||
// Verify that no connection already exists with this name.
|
// Verify that no connection already exists with this name.
|
||||||
MySQLConnection previousConnection =
|
MySQLConnection previousConnection =
|
||||||
connectionService.retrieveConnection(mySQLConnection.getName(), user_id, parentID);
|
connectionService.retrieveConnection(mySQLConnection.getName(), parentID, user_id);
|
||||||
if(previousConnection != null)
|
if(previousConnection != null)
|
||||||
throw new GuacamoleClientException("That connection name is already in use.");
|
throw new GuacamoleClientException("That connection name is already in use.");
|
||||||
|
|
||||||
|
@@ -156,7 +156,7 @@ public class ConnectionGroupDirectory implements Directory<String, ConnectionGro
|
|||||||
|
|
||||||
// Verify that no connection already exists with this name.
|
// Verify that no connection already exists with this name.
|
||||||
MySQLConnectionGroup previousConnectionGroup =
|
MySQLConnectionGroup previousConnectionGroup =
|
||||||
connectionGroupService.retrieveConnectionGroup(name, user_id, parentID);
|
connectionGroupService.retrieveConnectionGroup(name, parentID, user_id);
|
||||||
if(previousConnectionGroup != null)
|
if(previousConnectionGroup != null)
|
||||||
throw new GuacamoleClientException("That connection group name is already in use.");
|
throw new GuacamoleClientException("That connection group name is already in use.");
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ public class ConnectionGroupDirectory implements Directory<String, ConnectionGro
|
|||||||
|
|
||||||
// Verify that no connection already exists with this name.
|
// Verify that no connection already exists with this name.
|
||||||
MySQLConnectionGroup previousConnectionGroup =
|
MySQLConnectionGroup previousConnectionGroup =
|
||||||
connectionGroupService.retrieveConnectionGroup(mySQLConnectionGroup.getName(), user_id, parentID);
|
connectionGroupService.retrieveConnectionGroup(mySQLConnectionGroup.getName(), parentID, user_id);
|
||||||
if(previousConnectionGroup != null)
|
if(previousConnectionGroup != null)
|
||||||
throw new GuacamoleClientException("That connection group name is already in use.");
|
throw new GuacamoleClientException("That connection group name is already in use.");
|
||||||
|
|
||||||
|
@@ -37,6 +37,7 @@ package net.sourceforge.guacamole.net.auth.mysql.service;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -161,7 +162,7 @@ public class PermissionCheckService {
|
|||||||
* @throws GuacamoleSecurityException If the specified permission is not
|
* @throws GuacamoleSecurityException If the specified permission is not
|
||||||
* granted.
|
* granted.
|
||||||
*/
|
*/
|
||||||
public void verifyConnectionGroupAccess(int userID, int affectedConnectionGroupID, String permissionType) throws GuacamoleSecurityException {
|
public void verifyConnectionGroupAccess(int userID, Integer affectedConnectionGroupID, String permissionType) throws GuacamoleSecurityException {
|
||||||
|
|
||||||
// If permission does not exist, throw exception
|
// If permission does not exist, throw exception
|
||||||
if(!checkConnectionGroupAccess(userID, affectedConnectionGroupID, permissionType))
|
if(!checkConnectionGroupAccess(userID, affectedConnectionGroupID, permissionType))
|
||||||
@@ -440,6 +441,10 @@ public class PermissionCheckService {
|
|||||||
if(checkParentID) {
|
if(checkParentID) {
|
||||||
// Get the IDs of all connections in the connection group
|
// Get the IDs of all connections in the connection group
|
||||||
List<Integer> allConnectionIDs = connectionService.getAllConnectionIDs(parentID);
|
List<Integer> allConnectionIDs = connectionService.getAllConnectionIDs(parentID);
|
||||||
|
|
||||||
|
if(allConnectionIDs.isEmpty())
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
|
||||||
criteria.andConnection_idIn(allConnectionIDs);
|
criteria.andConnection_idIn(allConnectionIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,6 +527,10 @@ public class PermissionCheckService {
|
|||||||
// Get the IDs of all connection groups in the connection group
|
// Get the IDs of all connection groups in the connection group
|
||||||
List<Integer> allConnectionGroupIDs = connectionGroupService
|
List<Integer> allConnectionGroupIDs = connectionGroupService
|
||||||
.getAllConnectionGroupIDs(parentID);
|
.getAllConnectionGroupIDs(parentID);
|
||||||
|
|
||||||
|
if(allConnectionGroupIDs.isEmpty())
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
|
||||||
criteria.andConnection_group_idIn(allConnectionGroupIDs);
|
criteria.andConnection_group_idIn(allConnectionGroupIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user