CategoryAPIImpl.removeAllChildren throws UnsupportedOperationException when a child category can't be deleted
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryAPIImpl.javaの794行目付近にあるremoveAllChildrenから始め、次にCategoriesResourceとCategoryAjaxに記載された呼び出し元をたどってください。カテゴリAPIの統合テストを確認し、ユーザーが削除できない子のテストを追加してください。その子がスキップされたものとして返され、残りの子が処理され、置換インポートとレガシー削除動作が受け入れ基準を満たせば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem Statement
CategoryAPIImpl.removeAllChildren (dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryAPIImpl.java, around line 794) is meant to delete every child of a category and return the ones it could not delete. The list it returns is created unmodifiable:
final List<Category> unableToDelete = Collections.unmodifiableList(new ArrayList<>());
...
} catch (final DotDataException | DotSecurityException e) {
...
unableToDelete.add(category); // throws UnsupportedOperationException
}
So as soon as one child cannot be deleted (for example, the user does not have EDIT on that child), add throws UnsupportedOperationException. The exception leaves the loop, the remaining children are not processed, and the caller gets an error instead of the list of skipped children.
Callers:
CategoriesResourceimport (POST /api/v1/categories/_import) withexportType=replaceand acontextInode, used by the Categories portlet's import in "replace" mode inside a parent category. The import stops beforeaddOrUpdateCategoryruns, so the user can be left with some children deleted, the rest still there, and nothing imported (depending on whether the earlier deletes are rolled back; not verified).CategoryAjax.deleteCategories(contextInode)andCategoryAjaximport (legacy categories screen).
Impact: only when at least one child cannot be deleted by the current user. Nothing is deleted that the user is not allowed to delete; the operation just fails partway instead of reporting the skipped children.
Steps to Reproduce
- As admin, create category
Parentwith childrenA,BandC. - Create a back-end user with EDIT on
Parent,AandC, but only READ onB. - As that user, open Settings > Categories, go into
Parent, and import a CSV in "replace" mode. - Actual: the request fails with a server error; the log shows
UnsupportedOperationExceptionfromCategoryAPIImpl.removeAllChildren. Children afterBin the loop are not deleted and the CSV is not imported. - Expected:
AandCare deleted,Bis reported as not deleted, and the CSV is imported.
Acceptance Criteria
-
removeAllChildrenreturns the children it could not delete instead of throwing, and keeps processing the remaining children. - A "replace" import inside a parent category reports the children it could not delete and still imports the file.
-
CategoryAjax.deleteCategories(contextInode)returnsSOME_CATEGORIES_DELETEDin the same situation. - An integration test covers
removeAllChildrenwith one child the user cannot delete.
dotCMS Version
Latest from main branch
Severity
Medium - Some functionality impacted
Links
NA
- 主要言語
- Java
- スター
- 972
- フォーク
- 489
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 199
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotCMS/core のほかの issue
-
Escape the Binary field hint in the legacy content editor so an apostrophe doesn't break the fieldオープンOKR : Customer Support Team : Maintenance Type : Defect
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 2 日以内に返信
-
dotCMS : Permissions OKR : Customer Support Team : Maintenance Type : Defect
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
dotCMS : UVE OKR : Customer Support Team : Maintenance Type : Defect
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
dotCMS/core#38260 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Enable the Add to Bundle action in the Pages portlet row menu (hard-coded disabled since PR 34715)オープンdotCMS : Push Publishing OKR : Customer Support Team : Maintenance Type : Defect
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 2 日以内に返信
-
[TASK] Postman and Karate test stacks sleep 3 s after every write対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンTeam : Platform Type : Test Automation
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
dotCMS/core#38225 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
似ている issue
-
status: waiting-for-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
spring-projects/spring-framework#37614 ·
メンテナーはふだん 1 日以内に返信
-
azure-spring azure-spring-aad Client
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Azure/azure-sdk-for-java#51046 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
helm-knative-apply.sh fails with Helm 4対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea: triage theme: undefined
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
jhipster/generator-jhipster#35895 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
oracle/graalvm-reachability-metadata#11659 ·
メンテナーはふだん 1 日以内に返信