Skip to content

Commit

Permalink
Fix problem with updating roles in group member
Browse files Browse the repository at this point in the history
  • Loading branch information
cgeorgilakis-grnet committed Feb 24, 2025
1 parent a476f1b commit b425b1f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes in keycloak-group-management will be documented in this file
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.5.3] - 2025-02-24

### Fixed
- Fix problem with updating roles in group member

## [1.5.2] - 2025-02-17

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<quarkus.version>3.2.7.Final</quarkus.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<agm-version>1.5.2</agm-version>
<agm-version>1.5.3</agm-version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class UserGroupMembershipExtensionEntity {
@Column(name = "GROUP_ENROLLMENT_CONFIGURATION_ID")
private String groupEnrollmentConfigurationId;

@ManyToMany(fetch = FetchType.EAGER)
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "GROUP_MEMBERSHIP_ROLES", joinColumns = @JoinColumn(name = "USER_GROUP_MEMBERSHIP_EXTENSION_ID"), inverseJoinColumns = @JoinColumn(name = "GROUP_ROLES_ID"))
private Set<GroupRolesEntity> groupRoles;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,10 @@ public void update(UserGroupMembershipExtensionRepresentation rep, UserGroupMemb
}
entity.setStatus(LocalDate.now().isBefore(entity.getValidFrom()) ? MemberStatusEnum.PENDING : MemberStatusEnum.ENABLED);
if (rep.getGroupRoles() != null) {
entity.setGroupRoles(rep.getGroupRoles().stream().map(x -> groupRolesRepository.getGroupRolesByNameAndGroup(x, entity.getGroup().getId())).filter(Objects::nonNull).collect(Collectors.toSet()));
entity.getGroupRoles().clear();
entity.getGroupRoles().addAll(rep.getGroupRoles().stream().map(x -> groupRolesRepository.getGroupRolesByNameAndGroup(x, entity.getGroup().getId())).filter(Objects::nonNull).collect(Collectors.toSet()));
} else {
entity.setGroupRoles(null);
entity.getGroupRoles().clear();
}

update(entity);
Expand Down

0 comments on commit b425b1f

Please sign in to comment.