Repository navigation
LDAP: add the five LDAPServers columns a 1.5 table lacks - #42
Merged
Merged
Conversation
A server upgraded from 1.5 could not add or edit an LDAP server: save() failed with "Unknown column 'lsGroupNamAttr'" (forum topic 18300). Every released 1.5.10 LDAPServers table stops at lsEnableNestedGroup. createSql() is CREATE TABLE IF NOT EXISTS, so it leaves that table as it is, and no schema() step added lsGroupNamAttr, lsDisplayNameEnabled, lsDisplayNameAttr, lsIsLDAPs or lsAllowAPI. Reads hid the gap because getColumns() drops an absent column. save() names every declared column. Step 29 adds each column only when it is absent. Only then does it backfill the rows to the 1.5 behavior: group-name attribute 'name' (1.5 hard-coded (name=%s)), LDAPS for ports 636/686/3269/7636, display name and API sign-in off. An install that already has a column is unchanged. The new test pins the 1.5.10.2534 column list. It fails on the old code with exactly these five columns, and passes on this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A server upgraded from 1.5 cannot add or edit an LDAP server. The UI shows "Add LDAP server failed!". The database answers
Unknown column 'lsGroupNamAttr'. Reported in forum topic 18300.Cause
Every released 1.5.10
LDAPServerstable stops atlsEnableNestedGroup.createSql()isCREATE TABLE IF NOT EXISTS, so it leaves the 1.5 table as it is. Noschema()step addslsGroupNamAttr,lsDisplayNameEnabled,lsDisplayNameAttr,lsIsLDAPsorlsAllowAPI. Reads hide the gap, becausegetColumns()drops an absent column.save()names every declared column, so every write fails. "Update" on Plugin Management runs the pending steps, but none of them add these columns.Fix
Step 29 adds each column only when it is absent. Only then does it backfill the existing rows to the 1.5 behavior:
lsGroupNamAttrname(name=%s)lsIsLDAPslsDisplayNameEnabled,lsDisplayNameAttr,lsAllowAPIAn install that already has a column keeps its rows unchanged.
Verification
sql_mode, withLDAPServerscut back to the 1.5.10.2534 shape. Before:save()fails with1054 Unknown column 'lsGroupNamAttr'. Afterschema()[29]:save()succeeds, existing rows getname, the port-636 row getslsIsLDAPs = 1, and a second run changes nothing.tests/ldap-upgrade-from-15-columns.test.phppins the 1.5.10.2534 column list. Onmainit fails and names exactly the five columns. On this branch it passes.sh tests/run-all.sh: 21 passed.Known limit
If the
ADD COLUMNsucceeds and its backfillUPDATEthen fails, a retry sees the column and skips the backfill. Those rows keep''/ 0.🤖 Generated with Claude Code