mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-13 22:15:26 +00:00
fixed issue where users in usergroups were not loaded correctly
This commit is contained in:
1 parent
735c974280
commit
968dae3093
2 files changed
+13
-9
No files matched your search
+2
-1
@@ -1,6 +1,7 @@
|
||||
package com.sap.sse.security.shared.dto;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sse.security.shared.AbstractUserGroupImpl;
|
||||
@@ -16,7 +17,7 @@ public class UserGroupDTO extends AbstractUserGroupImpl<StrippedUserDTO> impleme
|
||||
super(null, null, null);
|
||||
}
|
||||
|
||||
public UserGroupDTO(HashSet<StrippedUserDTO> users, UUID id, String name) {
|
||||
public UserGroupDTO(Set<StrippedUserDTO> users, UUID id, String name) {
|
||||
super(users, id, name);
|
||||
}
|
||||
|
||||
|
||||
+11
-8
@@ -3,6 +3,7 @@ package com.sap.sse.security.ui.server;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@@ -184,14 +185,7 @@ public class SecurityDTOFactory {
|
||||
if (userGroup == null) {
|
||||
result = null;
|
||||
} else {
|
||||
// we do not cache this, as they are only valid as root type of objects, so they cannot be already be in the
|
||||
// map at this point
|
||||
if (fromOriginalToStrippedDownUserGroup.get(userGroup) != null) {
|
||||
throw new IllegalArgumentException(
|
||||
"A stripped mapping does already exist for this usergroup, this should never be the case");
|
||||
}
|
||||
// FIXME can this generic cast be made better?
|
||||
result = new UserGroupDTO(userGroup.getId(), userGroup.getName());
|
||||
result = new UserGroupDTO(createStrippedUsersFromUsers(userGroup.getUsers(), securityService, fromOriginalToStrippedDownUser, fromOriginalToStrippedDownUserGroup),userGroup.getId(), userGroup.getName());
|
||||
SecurityDTOUtil.addSecurityInformation(this, securityService, result, userGroup.getIdentifier(),
|
||||
fromOriginalToStrippedDownUser, fromOriginalToStrippedDownUserGroup);
|
||||
}
|
||||
@@ -313,6 +307,15 @@ public class SecurityDTOFactory {
|
||||
annotation.getDisplayNameOfAnnotatedObject());
|
||||
}
|
||||
|
||||
public Set<StrippedUserDTO> createStrippedUsersFromUsers(Iterable<User> users, SecurityService securityService,
|
||||
Map<User, StrippedUserDTO> fromOriginalToStrippedDownUser,
|
||||
Map<UserGroup, StrippedUserGroupDTO> fromOriginalToStrippedDownUserGroup) {
|
||||
Set<StrippedUserDTO> result = new HashSet<>();
|
||||
users.forEach(user -> result.add(createStrippedUserFromUser(user, securityService,
|
||||
fromOriginalToStrippedDownUser, fromOriginalToStrippedDownUserGroup)));
|
||||
return result;
|
||||
}
|
||||
|
||||
public StrippedUserDTO createStrippedUserFromUser(User user, SecurityService securityService,
|
||||
Map<User, StrippedUserDTO> fromOriginalToStrippedDownUser,
|
||||
Map<UserGroup, StrippedUserGroupDTO> fromOriginalToStrippedDownUserGroup) {
|
||||
|
||||
Reference in new issue
Block a user