mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-30 16:43:22 +00:00 
			
		
		
		
	Ticket #269: Connection permission check should actually check connections. Add generatedKey elements to generatorConfig.xml such that IDs are queried back after insert of users and connections.
This commit is contained in:
		| @@ -405,12 +405,12 @@ public class UserDirectory implements Directory<String, net.sourceforge.guacamol | ||||
|  | ||||
|         // Get list of administerable connection IDs | ||||
|         List<Integer> administerableConnectionIDs = | ||||
|             permissionCheckService.retrieveUserIDs(this.user_id, | ||||
|             permissionCheckService.retrieveConnectionIDs(this.user_id, | ||||
|                 MySQLConstants.CONNECTION_ADMINISTER); | ||||
|  | ||||
|         // Get set of names corresponding to administerable connections | ||||
|         Map<String, Integer> administerableConnections = | ||||
|                 userService.translateUsernames(administerableConnectionIDs); | ||||
|                 connectionService.translateNames(administerableConnectionIDs); | ||||
|  | ||||
|         // Insert all given permissions | ||||
|         for (ConnectionPermission permission : permissions) { | ||||
|   | ||||
| @@ -290,7 +290,7 @@ public class PermissionCheckService { | ||||
|             // Construct permission from data | ||||
|             UserPermission permission = new UserPermission( | ||||
|                 UserPermission.Type.valueOf(userPermission.getPermission()), | ||||
|                 affectedUsers.get(userPermission.getUser_id()) | ||||
|                 affectedUsers.get(userPermission.getAffected_user_id()) | ||||
|             ); | ||||
|  | ||||
|             // Add to set | ||||
| @@ -327,7 +327,7 @@ public class PermissionCheckService { | ||||
|             connectionIDs.add(connectionPermission.getConnection_id()); | ||||
|  | ||||
|         // Get corresponding names | ||||
|         Map<Integer, String> affectedUsers = | ||||
|         Map<Integer, String> affectedConnections = | ||||
|                 connectionService.retrieveNames(connectionIDs); | ||||
|  | ||||
|         // Add connection permissions | ||||
| @@ -336,7 +336,7 @@ public class PermissionCheckService { | ||||
|             // Construct permission from data | ||||
|             ConnectionPermission permission = new ConnectionPermission( | ||||
|                 ConnectionPermission.Type.valueOf(connectionPermission.getPermission()), | ||||
|                 affectedUsers.get(connectionPermission.getUser_id()) | ||||
|                 affectedConnections.get(connectionPermission.getConnection_id()) | ||||
|             ); | ||||
|  | ||||
|             // Add to set | ||||
|   | ||||
| @@ -32,6 +32,8 @@ | ||||
|             domainObjectName="Connection" > | ||||
|             <property name="useActualColumnNames" value="true"/> | ||||
|             <property name="ignoreQualifiersAtRuntime" value="true"/> | ||||
|             <generatedKey column="connection_id" identity="true" | ||||
|                 sqlStatement="SELECT LAST_INSERT_ID()"/> | ||||
|         </table> | ||||
|  | ||||
|         <table tableName="guacamole_connection_parameter" | ||||
| @@ -64,6 +66,8 @@ | ||||
|             domainObjectName="User" > | ||||
|             <property name="useActualColumnNames" value="true"/> | ||||
|             <property name="ignoreQualifiersAtRuntime" value="true"/> | ||||
|             <generatedKey column="user_id" identity="true" | ||||
|                 sqlStatement="SELECT LAST_INSERT_ID()"/> | ||||
|         </table> | ||||
|  | ||||
|         <table tableName="guacamole_user_permission" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user