Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort subgroups #19348

Closed
2 tasks done
npriebe opened this issue Mar 27, 2023 · 8 comments · Fixed by #22295
Closed
2 tasks done

Sort subgroups #19348

npriebe opened this issue Mar 27, 2023 · 8 comments · Fixed by #22295
Labels
area/storage Indicates an issue that touches storage (change in data layout or data manipulation) help wanted kind/enhancement Categorizes a PR related to an enhancement
Milestone

Comments

@npriebe
Copy link

npriebe commented Mar 27, 2023

Before reporting an issue

  • I have searched existing issues
  • I have reproduced the issue with the latest release

Area

account/api

Describe the bug

Hi,

I have updated my Keycloak from 19.0.2 to 21.0.1.
Now I have the problem that the groups are not sorted. It doesn't matter whether I create new groups or move existing ones.

However, if I now set up a new Keycloak instance, the sorting works properly when creating and moving groups.

Here an example of my groups:

Screenshot from 2023-03-27 08-13-14

Version

21.0.1

Expected behavior

Actual behavior

How to Reproduce?

Anything else?

No response

@npriebe npriebe added kind/bug Categorizes a PR related to a bug status/triage labels Mar 27, 2023
@mposolda mposolda added area/storage Indicates an issue that touches storage (change in data layout or data manipulation) and removed area/account/api labels May 17, 2023
@ghost ghost added the team/store label May 17, 2023
@vramik vramik self-assigned this May 18, 2023
@vramik
Copy link
Contributor

vramik commented May 18, 2023

Hello @npriebe, thanks for the report. Could you please share more information regarding database you're using?

@npriebe
Copy link
Author

npriebe commented May 22, 2023

Hi @vramik , my Keycloak is running under Docker for now the database is running under a MySQL server.
The server data are:

Server type: MySQL
Server version: 5.7.12 - MySQL Community Server (GPL)
Protocol version: 10
Server charset: cp1252 West European (latin1)

@vramik
Copy link
Contributor

vramik commented May 29, 2023

Thanks @npriebe, could you please elaborate a bit more on the sorting itself? I was digging in a code and found out that top level groups should be sorted by its name:

@NamedQuery(name="getTopLevelGroupIds", query="select u.id from GroupEntity u where u.parentId = :parent and u.realm = :realm order by u.name ASC"),

while subgroups have no ordering what so ever (unless sorted by ui):

@NamedQuery(name="getGroupIdsByParent", query="select u.id from GroupEntity u where u.parentId = :parent"),

I got consistent finding with both migrating from 19.0.2 to 21.0.1 and 21.0.1 started from scratch.

If the issue is about sorting subgroups, I'll change it to enhancement.

@npriebe
Copy link
Author

npriebe commented May 30, 2023

Thank you for your efforts @vramik

I had tested this again and as it is described in the code, the top groups are sorted cleanly.
Furthermore, I had also looked again since which version the groups already exist in my keycloak. I have been using Keycloak since version 4.8.2 and in this version the groups already existed. Maybe they were already in the wrong order at that time.

I had also set up a completely new keycloak from scratch, where these problems did not occur afterwards. So it could really have been a problem with the group UI at the time.

It would therefore make sense if the sub-groups were also sorted by name as standard, so that this is consistent with the top groups.

@vramik
Copy link
Contributor

vramik commented May 30, 2023

Thanks @npriebe, I agree it makes sense to sub-groups to be sorted as well. As it's not a regression I'll switch the issue to enhancement.

@vramik vramik added kind/enhancement Categorizes a PR related to an enhancement and removed kind/bug Categorizes a PR related to a bug status/triage labels May 30, 2023
@vramik vramik removed their assignment May 30, 2023
@hmlnarik hmlnarik changed the title After the update to 21.0.1 groups are not sorted Sort subgroups May 31, 2023
@transducer
Copy link
Contributor

We would also like to see sorted subgroups.

Todor13 added a commit to Todor13/keycloak that referenced this issue Aug 7, 2023
ahus1 added a commit that referenced this issue Aug 7, 2023
* Review comments to add a test, update the API description and adjust the map storage.

Closes #19348

Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
wojnarfilip pushed a commit to wojnarfilip/keycloak that referenced this issue Aug 14, 2023
* Review comments to add a test, update the API description and adjust the map storage.

Closes keycloak#19348

Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
@npriebe
Copy link
Author

npriebe commented Aug 25, 2023

@vramik In which version will the improvement be available? Could you possibly add a milestone to the issue?

@vramik
Copy link
Contributor

vramik commented Aug 25, 2023

@npriebe it should be available in 23.0.0.

@vramik vramik added this to the 23.0.0 milestone Aug 25, 2023
ahus1 pushed a commit to ahus1/keycloak that referenced this issue Oct 13, 2023
* Review comments to add a test, update the API description and adjust the map storage.

Closes keycloak#19348

Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
(cherry picked from commit dffa7a3)
@ahus1 ahus1 modified the milestones: 23.0.0, 22.0.5 Oct 16, 2023
mhajas pushed a commit that referenced this issue Oct 16, 2023
* Review comments to add a test, update the API description and adjust the map storage.

Closes #19348

Co-authored-by: Alexander Schwartz <aschwart@redhat.com>
(cherry picked from commit dffa7a3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/storage Indicates an issue that touches storage (change in data layout or data manipulation) help wanted kind/enhancement Categorizes a PR related to an enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants