Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
14487b62eb | |||
e87a6b68a7 | |||
19f21fdd5c | |||
5ecb627dbf | |||
ea487fee31 | |||
9f9ededab2 | |||
f76105b979 | |||
a3cb17e402 | |||
c6d0977b2f | |||
2405a8a313 | |||
173bfed44f | |||
dc5a7dad39 | |||
10ed99b0a2 | |||
4e4a6aca8d | |||
44d0bf533d | |||
807294881b | |||
a42c754a09 | |||
8b05c51ef6 | |||
8bc03e0ea9 | |||
d32e3c7051 |
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.inteligr8.activiti</groupId>
|
||||
<artifactId>keycloak-activiti-app-ext</artifactId>
|
||||
<version>1.2-SNAPSHOT</version>
|
||||
<version>1.2.1</version>
|
||||
<name>Keycloak Authentication & Authorization for APS</name>
|
||||
|
||||
<properties>
|
||||
|
@@ -3,6 +3,8 @@ package com.inteligr8.activiti;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.NonUniqueResultException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -65,21 +67,28 @@ public class ActivitiAppAdminMembersFixer implements DataFixer {
|
||||
return;
|
||||
|
||||
Long tenantId = this.tenantFinderService.findTenantId();
|
||||
List<Group> groups;
|
||||
Group group1 = this.groupService.getGroupByExternalIdAndTenantId(this.adminGroupExternalId, tenantId);
|
||||
if (group1 != null) {
|
||||
groups = Arrays.asList(group1);
|
||||
} else {
|
||||
List<Group> groups = null;
|
||||
try {
|
||||
Group group1 = this.groupService.getGroupByExternalIdAndTenantId(this.adminGroupExternalId, tenantId);
|
||||
if (group1 != null)
|
||||
groups = Arrays.asList(group1);
|
||||
} catch (NonUniqueResultException nure) {
|
||||
// suppress
|
||||
}
|
||||
if (groups == null)
|
||||
groups = this.groupService.getGroupByNameAndTenantId(this.adminGroupName, tenantId);
|
||||
}
|
||||
|
||||
this.logger.debug("Found {} admin group(s)", groups.size());
|
||||
|
||||
for (String email : adminUsers) {
|
||||
User user = this.userService.findUserByEmail(email);
|
||||
|
||||
this.logger.debug("Adding {} to admin group(s)", user.getEmail());
|
||||
for (Group group : groups)
|
||||
this.groupService.addUserToGroup(group, user);
|
||||
User user = this.userService.findUserByEmailAndTenantId(email, tenantId);
|
||||
if (user == null) {
|
||||
this.logger.info("The user with email '{}' does not exist, so they cannot be added as an administrator", email);
|
||||
} else {
|
||||
this.logger.debug("Adding {} to admin group(s)", user.getEmail());
|
||||
for (Group group : groups)
|
||||
this.groupService.addUserToGroup(group, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user