M1 review round 2: the transport is no way round, nobody raises its own role, late staff collections

R2-1 the SMTP password is bound to server, port and user whatever the transport says; the transport alone is not bound.
R2-2 where the plugin's update rule is in force the roles field is closed for the account itself
     (the plugin's roles: only an admin; roles of the project's own: never one's own).
R2-3 auth collections a later plugin adds get the account rules, the password rule and the first-user endpoint when
     the config goes live; a staff slug that is not an auth collection stops the start.
R2-4 smtpRequireTls is taken out: the branch adds no field, column or collection.
Also: read (a staff account) and unlock (an admin) defaults on staff collections (accounts.staffOnlyRead);
doctor staff-own-roles and read / unlock in staff-accounts-open; r1 NULL against the default, also inside a row;
r2 bound values compared exactly.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 00:39:24 +01:00
co-authored by Claude Fable 5.2
parent a32329fbb4
commit 7002ebbfa6
20 changed files with 519 additions and 122 deletions
+3 -8
View File
@@ -11,8 +11,8 @@ type BuildSiteIntegrationsArgs = {
/** Extra fields injected by the client project */
additionalFields?: Field[]
/**
* A save in the panel that changes the SMTP server, port, user name, transport or "require
* encryption" must send the password again (or remove it). Default true; needs write-only
* A save through access control that changes the SMTP server, port or user name must send the
* password again (or remove it), whatever the transport. Default true; needs write-only
* secrets. `false` = the stored password follows the new server, as before.
*/
reenterSecretOnChange?: boolean
@@ -42,12 +42,7 @@ export function buildSiteIntegrations({
writeOnlySecrets: writeOnly = true,
}: BuildSiteIntegrationsArgs = {}): GlobalConfig {
const secret = (fields: Field[]) =>
writeOnly ? writeOnlySecrets(fields, INTEGRATION_SECRET_FIELDS, reenterSecretOnChange
? {
// not when the save switches to Microsoft Graph: the password is not used there, and its field is hidden
smtpPassword: { appliesWhen: (data) => data.emailTransport !== 'graph', boundTo: SMTP_PASSWORD_BOUND_TO },
}
: {}) : fields
writeOnly ? writeOnlySecrets(fields, INTEGRATION_SECRET_FIELDS, reenterSecretOnChange ? { smtpPassword: { boundTo: SMTP_PASSWORD_BOUND_TO } } : {}) : fields
return {
slug: 'site-integrations',
access: {