natural commented on a change in pull request #4003: NIFI-7051 Protect against
empty group membership in ShellUserGroupPro…
URL: https://github.com/apache/nifi/pull/4003#discussion_r369754102
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-shell-authorizer/src/main/java/org/apache/nifi/authorization/ShellUserGroupProvider.java
##########
@@ -194,10 +198,12 @@ public UserAndGroups getUserAndGroups(String identity)
throws AuthorizationAcces
logger.debug("Retrieved user {} for identity {}", new Object[]{user,
identity});
Set<Group> groups = new HashSet<>();
-
- for (Group g : getGroups()) {
- if (user != null && g.getUsers().contains(user.getIdentity())) {
- groups.add(g);
+ if (user != null) {
+ for (Group g : getGroups()) {
+ if (user != null &&
g.getUsers().contains(user.getIdentifier())) {
Review comment:
I'm not sure the null check needs to be repeated.
----------------------------------------------------------------
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