mike-jumper commented on a change in pull request #381: GUACAMOLE-696: In JDBC
module, merge effective groups
URL: https://github.com/apache/guacamole-client/pull/381#discussion_r281047273
##########
File path:
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledAuthenticatedUser.java
##########
@@ -168,5 +169,12 @@ public String getIdentifier() {
public void setIdentifier(String identifier) {
user.setIdentifier(identifier);
}
+
+ @Override
+ public Set<String> getEffectiveUserGroups() {
+ Set<String> allGroups = new HashSet<>(user.getEffectiveUserGroups());
+ allGroups.addAll(super.getEffectiveUserGroups());
+ return Collections.unmodifiableSet(allGroups);
Review comment:
Since we're using Guava, I suggest using `Sets.union()` to produce a
read-only merged view of the two sets, rather than creating a new merged set
through copying each element:
https://google.github.io/guava/releases/27.0.1-jre/api/docs/com/google/common/collect/Sets.html#union-java.util.Set-java.util.Set-
Other than that, I'm happy with these changes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services