EndzeitBegins commented on code in PR #9868:
URL: https://github.com/apache/nifi/pull/9868#discussion_r2205433948
##########
nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileUserGroupProvider.java:
##########
@@ -737,6 +758,35 @@ private void createUser(final Tenants tenants, final
String userIdentity) {
}
}
+ /**
+ * Finds the Group with the given name, or creates a new one and adds it
to Tenants.
+ *
+ * @param tenants the Tenants reference
+ * @param groupName the name of the group to look for
+ */
+ private void createGroup(final Tenants tenants, final String groupName) {
+ if (StringUtils.isBlank(groupName)) {
+ return;
+ }
+
+ // TODO stream api?
+ org.apache.nifi.authorization.file.tenants.generated.Group foundGroup
= null;
+ for (org.apache.nifi.authorization.file.tenants.generated.Group group
: tenants.getGroups().getGroup()) {
+ if (group.getName().equals(groupName)) {
+ foundGroup = group;
+ break;
+ }
+ }
+
+ if (foundGroup == null) {
+ final Group newGroup = new
Group.Builder().identifierGenerateFromSeed(groupName).name(groupName).build();
Review Comment:
I adjust the code for users and was able to remove `IdentifierUtil` entirely
indeed, good catch!
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]