Skip to content

MENDELU/Add "Allow external URLs" toggle to collection Content Source (#860) - #1414

Open
milanmajchrak wants to merge 1 commit into
customer/mendelufrom
mendelu/allow-external-urls-860
Open

MENDELU/Add "Allow external URLs" toggle to collection Content Source (#860)#1414
milanmajchrak wants to merge 1 commit into
customer/mendelufrom
mendelu/allow-external-urls-860

Conversation

@milanmajchrak

@milanmajchrak milanmajchrak commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Problem description

Issue: https://github.com/dataquest-dev/dspace-customers/issues/860

UI part of the fix. Adds the Allow external URLs checkbox to Collection → Edit → Content Source, with a short note on what it does and what the risk is when it is ticked.

Analysis

The checkbox only shows for "Harvest metadata and bitstreams", since that is the only type that downloads files. Unticked it renders as plain help text, ticked it renders as a warning, so the two states cannot be confused. The note is tied to the checkbox with aria-describedby.

It is a plain checkbox rather than a dynamic form control — the form's patchValue only covers the three existing containers, so a dynamic control would not revert on Discard.

Needs the backend: dataquest-dev/DSpace#1387. Merge that one first, otherwise the UI reports success while nothing is saved.

Manual Testing (if applicable)

860-1-allow-external-urls-control.mp4
860-2-ssrf-guard-in-action.mp4
860-1-control

Copilot review

  • Requested review from Copilot

Collection > Edit > Content Source now shows an "Allow external URLs" checkbox
when the harvest type is "Harvest metadata and bitstreams", together with a
short description of what it does and what the risk is when it is ticked
(dataquest-dev/dspace-customers#860).

The checkbox is a plain template control rather than a dynamic form control, so
it reverts correctly on Discard/Reinstate - the form's patchValue only names the
three existing containers. The warning renders whenever the harvest type
matches, not only when the box is ticked, because the administrator needs to
read it before ticking; the alert styling appears only in the risky state.

Requires the matching backend change; the REST field is allow_external_urls.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds UI support for the new allow_external_urls flag on a collection’s Content Source settings, enabling administrators to explicitly allow harvesting bitstreams from external hosts (with clear risk messaging and accessibility support). This aligns the Angular UI with the backend support introduced in the referenced backend PR.

Changes:

  • Add ContentSource.allowExternalUrls (autoserialized as allow_external_urls) with a deliberate false default.
  • Extend the Collection → Edit → Content Source UI to show an Allow external URLs checkbox and a descriptive warning when harvest type is METADATA_AND_BITSTREAMS.
  • Add unit tests covering visibility, toggling behavior, update dispatch, and aria-describedby linkage; add EN/CS translations for the new label and warning text.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/assets/i18n/en.json5 Adds English label + warning translations for the new checkbox/help text.
src/assets/i18n/cs.json5 Adds Czech label + warning translations (others fall back to EN).
src/app/core/shared/content-source.model.ts Introduces allowExternalUrls with @autoserializeAs('allow_external_urls') and default false.
src/app/collection-page/edit-collection-page/collection-source/collection-source.component.ts Adds harvest-type constant for the template and a handler to toggle + persist the flag via field updates.
src/app/collection-page/edit-collection-page/collection-source/collection-source.component.spec.ts Adds test coverage for UI presence/absence, styling, aria description, and update calls.
src/app/collection-page/edit-collection-page/collection-source/collection-source.component.html Renders the checkbox + warning block conditionally and styles the warning only in the risky state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants