Skip to content

[Backport dtq-dev] Issue 1360: allow to change license in workflow item, in PATCH operation (ufal#1365)#1327

Open
kosarko wants to merge 1 commit into
dataquest-dev:dtq-devfrom
kosarko:backport-1365-to-dtq-dev
Open

[Backport dtq-dev] Issue 1360: allow to change license in workflow item, in PATCH operation (ufal#1365)#1327
kosarko wants to merge 1 commit into
dataquest-dev:dtq-devfrom
kosarko:backport-1365-to-dtq-dev

Conversation

@kosarko

@kosarko kosarko commented Jun 8, 2026

Copy link
Copy Markdown

Backport of ufal#1365 to dtq-dev. The automated port-pr cherry-pick of 40672c3241 failed; resolved manually, and adapted to dtq-dev's existing license architecture (see below).

What ufal#1365 does

Lets a reviewer/editor change the CLARIN license of an item from a workflow item via PATCH /api/workflow/workflowitems/{id} with replace /license. It also tightens the edit-allowed gate (checkIfEditMetadataAllowedInCurrentStep) so it distinguishes "not claimed by anyone" (422) from "claimed by another user" (403, via AuthorizeException).

Adaptation vs the literal upstream change

ufal#1365 introduced a new helper ClarinLicenseUtils.updateLicenseForItem(...) and rerouted both the workspace /license path and the new workflow path through it. dtq-dev already has its own consolidated helper ClarinLicenseSubmissionUtils.applyLicense(context, item, name) (used by both the legacy /license path and the /sections/clarin-license/select path). To avoid two parallel license helpers on dtq-dev, this backport:

Status codes preserved (per the IT tests)

extractLicenseName deliberately mirrors ufal#1365's strict value validation (not dtq-dev's lenient section-step extractor), so the IT expectations hold:

  • non-replace op or malformed value ({}, ["..."]) → 400
  • non-existing license name → 404 (ClarinLicenseNotFoundException, which is @ResponseStatus(NOT_FOUND); intentionally not wrapped as 422)
  • valid name (string or {value: "..."}) → 200
  • workflow item claimed by another user → 403

Net change: 3 files (WorkflowItemRestRepository, ClarinWorkflowItemRestRepositoryIT new tests, TaskRestRepositoriesIT one 422→403 expectation).

Head branch is on my fork (kosarko/DSpace) since I don't have push access to dataquest-dev. No local Maven in this env — manually audited import order/usage/braces/exception mapping; CI compiles and runs the ITs.

…ion (ufal#1365)

* Issue 1360: allow to change license in workflow item, in PATCH operation

* improve fix + Integration test

* resolve Copilot comments

* resolve more MR comments

* return 404 in case PATCH request references non existing license

* improve error message for task claimed by other user

* resolve second round of Copilot comments

* small code refactoring

* fixed failing test

(cherry picked from commit 40672c3)
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kosarko, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 49 minutes and 38 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6769a0a1-c2d3-4987-801f-1cd197826f36

📥 Commits

Reviewing files that changed from the base of the PR and between 82085cb and 4a6006c.

📒 Files selected for processing (3)
  • dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/WorkflowItemRestRepository.java
  • dspace-server-webapp/src/test/java/org/dspace/app/rest/ClarinWorkflowItemRestRepositoryIT.java
  • dspace-server-webapp/src/test/java/org/dspace/app/rest/TaskRestRepositoriesIT.java

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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