LDAP Connection button.
Every LDAP_* setting server/authentication.js and packages/wekan-ldap read
straight from process.env can now be overridden from Admin Panel / Login,
with an explicit admin value winning over the env var and the env var
winning over nothing (models/lib/configResolver.js's resolveConfigValue(),
pure and unit-tested for the precedence and for its 'admin'/'env'/'default'
source tag). The Admin Panel LDAP section shows, next to every field,
which source is currently in effect - an env var name, "Admin Panel", or
"Unset" - so it is always clear whether a value comes from the environment
or from an admin override.
The bind password never reaches the browser: it is stored in the new
Settings.ldap.bindPassword field, which server/publications/settings.js
deliberately never publishes (only the boolean ldap.bindPasswordSet is).
The password input starts empty and an empty submission leaves the
existing value/source untouched, matching the existing mail-server
password field's pattern. hasConfigValue() is the parallel, secret-safe
resolver: it returns only a boolean and a source, never the value, and a
negative test fuzzes several secret shapes through it to prove that.
Found while wiring this up: packages/wekan-ldap/server/testConnection.js's
existing ldap_test_connection method had its isAdmin check commented out
("TODO: this needs to be fixed - security issue"), so any authenticated
user - not only an admin - could trigger a real LDAP bind attempt against
the configured directory. Fixed to require isAdmin, the same check every
other admin-only Settings method uses, before any connection is attempted.
A new "Test LDAP Connection" button in Admin Panel / Login calls this
method against whichever config (admin override or env var) is currently
resolved and shows the result - success or the directory's own error -
inline, satisfying the "get back error message visible at admin panel"
request without adding a second LDAP client dependency.
Switching between LDAP, OAuth2, SAML and password login already has its
own UI (the Login pane's "Default Authentication Method" selector plus
each method's own enabled flag) and needed no separate switcher; this only
extends "enabled" itself to be admin-overridable, the same as every other
LDAP field.
Scope: LDAP is covered end to end (override + test-connection). OAuth2/
SAML/CAS's env vars are unchanged and stay env-only for now - the resolver
is written to extend to them, but doing so was out of scope for this pass.
Tests: tests/configResolver.test.cjs (precedence, source tagging,
hasConfigValue's secret non-leak, redactCredentialsInUrl for the composite-
connection-string case); tests/ldapAdminOverrideSecurity.test.cjs (the
publication never sends ldap.bindPassword, a whole-tree negative sweep for
any OTHER publication doing the same, the isAdmin gate on
ldap_test_connection runs before any connection attempt, and the method's
response never carries the password); tests/settingPublishedFields.test.cjs
extended to understand dotted/sub-document published fields so it keeps
checking the LDAP section's currentSetting.ldap.* reads against what is
actually published.
Thanks to xet7 !
Keep service-specific values on the server, never publish passwords to the browser, and let the administrator opt out of MAIL_URL in favor of Nodemailer's bundled SMTP service profiles. Add unit, negative, publication, and browser coverage.\n\nThanks to xet7 !
Publish enablePermanentDelete back to the client after the Global Admin changes it. Without the reactive value, the saved setting was rendered as undefined and the optimistic checkmark immediately reverted.
Thanks to xet7 !
"Support page enabled" animated to checked and fell back to unchecked. The reason
was not the checkbox: Admin Panel / Settings / Visibility draws it from
`currentSetting.supportPageEnabled`, and that field was not in the `setting`
publication. On the client it was therefore always undefined - the box drew
unchecked, ticking it wrote the setting to the server, and the next re-render drew
it unchecked again. The setting was saved; the checkbox said it was not.
Announcement's checkbox never had the problem because it reads the Announcements
collection, which is published whole - which is exactly why that one worked and
the Settings-backed ones did not.
Now published, and each of them is a control that was unusable: supportPageEnabled,
supportPagePublic, supportTitle, supportPageText, supportPopupText,
hideBoardActivitiesOnAllBoards (Visibility / All Boards) and
boardMembersFromSameOrgOnly / boardMembersFromSameTeamOnly (People / Organizations
and Teams). The SMTP settings stay out: they carry a password and have their own
admin-gated publication.
tests/settingPublishedFields.test.cjs walks every `currentSetting.<field>` in every
client template and fails when the publication does not carry it, so the next field
added to a pane cannot silently render as undefined.
Thanks to xet7 !