Skip to content

fix: search class groups by display name and abbreviation - #15

Open
eluttine wants to merge 2 commits into
mainfrom
fix/class-group-search
Open

eluttine wants to merge 2 commits into
mainfrom
fix/class-group-search

Conversation

@eluttine

@eluttine eluttine commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Problem

Teachers could not find some class groups in the share dialog. Groups that had been renamed since they were first synced were unfindable by the name shown in the UI, while unrenamed groups in the same school worked. Typing part of the group's old name found it, which was the clue.

Root cause

ClassGroupMapper::searchEntriesInner() matched the search term against the gid column only, but the picker labels each hit with IGroup::getDisplayName().

For LDAP groups those two are not the same string. Nextcloud has no stable internal id for groups: the gid is frozen at whatever ldapGroupDisplayName held when user_ldap first mapped the group, and a later rename updates only
the display name. So the app was searching a name no user has seen since the rename.

Neither was the group's abbreviation (its LDAP cn) searchable, although that is how teachers and admins usually refer to a school's groups.

Changes

  • Migration Version1001Date20260909120000 adds nullable display_name and abbreviation columns to groupsharemachine_groups.
  • LdapSync stores both on every sync: display_name from the configured ldapGroupDisplayName attribute (so it matches what Nextcloud shows), abbreviation from cn. Both come out of the LDAP record already being
    fetched — no extra queries.
  • ClassGroupMapper matches gid OR display_name OR abbreviation. The stale gid keeps working, so existing habits don't break.
  • Version bumped to 1.0.1 so occ upgrade runs the migration.

Testing

  • dev/ldap/rename-group.sh (new) reproduces the condition locally by renaming a seed group after it has been mapped. Verified on Nextcloud 33 with the docker LDAP: gid = 1A / display_name = Klasse 1A, and the share dialog finds the group by "Klasse", by the abbreviation, and by the stale gid. School scoping still holds — the other school's groups stay hidden.
  • New regression test in ClassGroupMapperTest covering all three columns.
  • phpunit 43/43, Psalm clean, php-cs-fixer clean.

Deployment

The search does not improve until the new columns are populated:

occ upgrade
occ groupsharemachine:sync

Existing rows keep working meanwhile — the columns match is unchanged.

@eluttine eluttine added the bug Something isn't working label Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant