When Organization feature is enabled UserAdapter.getGroupsCount() returns wrong result
Closes #32460 Signed-off-by: vramik <vramik@redhat.com>
This commit is contained in:
parent
c821ecb908
commit
37f42430e6
1 changed files with 3 additions and 3 deletions
|
@ -399,10 +399,10 @@ public class UserAdapter implements UserModel, JpaModel<UserEntity> {
|
||||||
public long getGroupsCount() {
|
public long getGroupsCount() {
|
||||||
Long result = createCountGroupsQuery().getSingleResult();
|
Long result = createCountGroupsQuery().getSingleResult();
|
||||||
if (Profile.isFeatureEnabled(Feature.ORGANIZATION)) {
|
if (Profile.isFeatureEnabled(Feature.ORGANIZATION)) {
|
||||||
OrganizationProvider provider = session.getProvider(OrganizationProvider.class);
|
if (result > 0) {
|
||||||
if (result > 0 && provider.getByMember(this) != null) {
|
|
||||||
// remove from the count the organization group membership
|
// remove from the count the organization group membership
|
||||||
result--;
|
OrganizationProvider provider = session.getProvider(OrganizationProvider.class);
|
||||||
|
result -= provider.getByMember(this).count();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue