diff --git a/src/main/java/io/fusionauth/domain/GroupMember.java b/src/main/java/io/fusionauth/domain/GroupMember.java index f6a55889..d2349869 100644 --- a/src/main/java/io/fusionauth/domain/GroupMember.java +++ b/src/main/java/io/fusionauth/domain/GroupMember.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2022, FusionAuth, All Rights Reserved + * Copyright (c) 2018-2024, FusionAuth, All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,10 @@ public class GroupMember implements Buildable { public ZonedDateTime insertInstant; + /** + * Deprecated since 1.52.0 (Aug 2024). Planned removal by end of 2024 + */ + @Deprecated public User user; public UUID userId; diff --git a/src/main/java/io/fusionauth/domain/search/GroupMemberSearchCriteria.java b/src/main/java/io/fusionauth/domain/search/GroupMemberSearchCriteria.java index 2a6e1438..09fd557c 100644 --- a/src/main/java/io/fusionauth/domain/search/GroupMemberSearchCriteria.java +++ b/src/main/java/io/fusionauth/domain/search/GroupMemberSearchCriteria.java @@ -1,5 +1,17 @@ /* - * Copyright (c) 2022, FusionAuth, All Rights Reserved + * Copyright (c) 2022-2024, FusionAuth, All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. */ package io.fusionauth.domain.search; @@ -41,11 +53,14 @@ public Set supportedOrderByColumns() { @Override protected String defaultOrderBy() { - return "insertInstant ASC"; + // All memberships for a given group share an insertInstant because they are recreated each time + // Add userId to provide consistent ordering within a group. The groupId ordering ensures consistency + // for a single user's memberships across multiple groups if they happen to have the same insertInstant. + return "insertInstant ASC, userId ASC, groupId ASC"; } static { - SortableFields.put("id", "id"); + SortableFields.put("id", "gm.id"); SortableFields.put("insertInstant", "gm.insert_instant"); SortableFields.put("groupId", "gm.groups_id"); SortableFields.put("tenantId", "g.tenants_id");