Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

feat(Schema): whitelist defaultAutoShare boolean configuration key#1944

Merged
rubenvdlinde merged 1 commit into
developmentfrom
feature/577-schema-default-auto-share
May 27, 2026
Merged

feat(Schema): whitelist defaultAutoShare boolean configuration key#1944
rubenvdlinde merged 1 commit into
developmentfrom
feature/577-schema-default-auto-share

Conversation

@WilcoLouwerse

Copy link
Copy Markdown
Contributor

Summary

  • lib/Db/Schema.php::validateConfigurationArray() strips any configuration key not in its allow-list. Adds defaultAutoShare to the $boolFields whitelist so schemas can persist the new key without it being silently dropped on save.
  • Also documents the new key in setConfiguration()'s PHPDoc.

Why

Read by the attachment-upload dialog (CnFilesTab in @conduction/nextcloud-vue, and the legacy UploadFiles.vue in opencatalogi) to seed the "Automatically publish" toggle from per-schema configuration. true = toggle on by default; absent / false = off (existing behaviour). Users can always override per upload — the schema value never coerces the submitted share field.

Without this whitelist entry, every PUT that includes configuration.defaultAutoShare returns 200 but the key is dropped server-side, so the consumer never sees the value. Verified by curl -X PUT … -d '{"configuration": {…, "defaultAutoShare": true}}': before this change the response body's configuration object had no defaultAutoShare; after this change it round-trips intact.

Companion PRs

Closes ConductionNL/opencatalogi#577 (backend half).

Backward compatibility

  • Strictly additive: adds one entry to an existing whitelist. No semantic change for any other key.
  • Existing schemas without defaultAutoShare continue to behave exactly as before (validator drop = no key = treated as off downstream).
  • No DB migration; the configuration column is already JSON. Existing persisted configs are untouched.

Test plan

  • Manual: PUT /api/schemas/{id} with configuration.defaultAutoShare: true — response body now contains the key (verified locally)
  • Existing PHPUnit suite passes in CI (this change touches a one-line allow-list; no new tests required unless reviewer prefers one)
  • Downstream smoke: with defaultAutoShare: true set on a schema, the CnFilesTab upload dialog seeds the "Automatically publish" toggle on (verifies end-to-end once the nextcloud-vue PR is released)

🤖 Generated with Claude Code

`Schema::validateConfigurationArray()` strips any configuration key not
in its allow-list. Adds `defaultAutoShare` to the `$boolFields`
whitelist so schemas can persist the new key without it being silently
dropped on save.

Read by the attachment-upload dialog (CnFilesTab in
@conduction/nextcloud-vue, and UploadFiles.vue in opencatalogi) to
seed the "Automatically publish" toggle. true = toggle on by default;
absent / false = toggle off (existing behaviour). Users can override
per upload — the schema value never coerces the final submitted
`share` field.

Companion to:
- ConductionNL/nextcloud-vue#455 (CnFilesTab share toggle)
- ConductionNL/opencatalogi#723 (UploadFiles legacy modal parity)

Closes ConductionNL/opencatalogi#577 (backend half).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants