Skip to content

Commit

Permalink
Add group info with federationLink
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengYanJin committed Jun 5, 2024
1 parent 3e945d7 commit bf62361
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ public Map<String, Long> countGroupsWithLink(@QueryParam("search") String search
@Operation(summary = "Find group")
public GroupWithLinkRepresentation findGroupWithLink(@PathParam("group-id") String id) {
GroupResource group = groupsResource.getGroupById(id);
if (group == null) {
throw new NotFoundException("Could not find group by id");
}

GroupWithLinkRepresentation groupWithLink = new GroupWithLinkRepresentation();

Expand All @@ -189,6 +186,16 @@ public GroupWithLinkRepresentation findGroupWithLink(@PathParam("group-id") Stri
.createNamedQuery("findByGroupId", GroupFederationLinkEntity.class)
.setParameter("groupId", id)
.getSingleResult();

groupWithLink.setId(group.getGroup().getId());
groupWithLink.setName(group.getGroup().getName());
groupWithLink.setPath(group.getGroup().getPath());
groupWithLink.setParentId(group.getGroup().getParentId());
groupWithLink.setSubGroupCount(group.getGroup().getSubGroupCount());
groupWithLink.setSubGroups(group.getGroup().getSubGroups());
groupWithLink.setAttributes(group.getGroup().getAttributes());
groupWithLink.setRealmRoles(group.getGroup().getRealmRoles());
groupWithLink.setClientRoles(group.getGroup().getClientRoles());
groupWithLink.setFederationLink(groupFederationLinkEntity.getFederationLink());
} catch (NoResultException e) {
logger.trace("No federation link found for group " + id, e);
Expand Down

0 comments on commit bf62361

Please sign in to comment.