System permission names should be compared with equals(), not startsWith().

This commit is contained in:
Michael Jumper
2013-08-14 22:59:57 -07:00
parent 5fab1ea8d2
commit 542947eaa0

View File

@@ -85,15 +85,15 @@ public class Update extends AuthenticatingHttpServlet {
throws GuacamoleException { throws GuacamoleException {
// Create user // Create user
if (str.startsWith(CREATE_USER_PERMISSION)) if (str.equals(CREATE_USER_PERMISSION))
return new SystemPermission(SystemPermission.Type.CREATE_USER); return new SystemPermission(SystemPermission.Type.CREATE_USER);
// Create connection // Create connection
if (str.startsWith(CREATE_CONNECTION_PERMISSION)) if (str.equals(CREATE_CONNECTION_PERMISSION))
return new SystemPermission(SystemPermission.Type.CREATE_CONNECTION); return new SystemPermission(SystemPermission.Type.CREATE_CONNECTION);
// Administration // Administration
if (str.startsWith(ADMIN_PERMISSION)) if (str.equals(ADMIN_PERMISSION))
return new SystemPermission(SystemPermission.Type.ADMINISTER); return new SystemPermission(SystemPermission.Type.ADMINISTER);
throw new GuacamoleException("Invalid permission string."); throw new GuacamoleException("Invalid permission string.");