You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/10/01 18:08:32 UTC
[31/38] guacamole-client git commit: GUACAMOLE-220: Clarify group
rename validation logic.
GUACAMOLE-220: Clarify group rename validation logic.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/a552d88c
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/a552d88c
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/a552d88c
Branch: refs/heads/master
Commit: a552d88c5481accaf135c5315a994cad0944fbf7
Parents: fedcceb
Author: Michael Jumper <mj...@apache.org>
Authored: Thu Sep 27 20:06:18 2018 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Thu Sep 27 20:06:18 2018 -0700
----------------------------------------------------------------------
.../auth/jdbc/usergroup/UserGroupService.java | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/a552d88c/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/usergroup/UserGroupService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/usergroup/UserGroupService.java b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/usergroup/UserGroupService.java
index dfe1ef5..0f4a216 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/usergroup/UserGroupService.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/usergroup/UserGroupService.java
@@ -162,19 +162,15 @@ public class UserGroupService extends ModeledDirectoryObjectService<ModeledUserG
super.beforeUpdate(user, object, model);
- // Username must not be blank
+ // Group names must not be blank
if (model.getIdentifier() == null || model.getIdentifier().trim().isEmpty())
throw new GuacamoleClientException("The group name must not be blank.");
- // Check whether such a group is already present
+ // Do not allow groups to be renamed if the name collides with that of
+ // another, existing group
UserGroupModel existing = userGroupMapper.selectOne(model.getIdentifier());
- if (existing != null) {
-
- // Do not rename to existing user group
- if (!existing.getObjectID().equals(model.getObjectID()))
- throw new GuacamoleClientException("Group \"" + model.getIdentifier() + "\" already exists.");
-
- }
+ if (existing != null && !existing.getObjectID().equals(model.getObjectID()))
+ throw new GuacamoleClientException("Group \"" + model.getIdentifier() + "\" already exists.");
}