CategoryAPIImpl.removeAllChildren throws UnsupportedOperationException when a child category can't be deleted
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 75/100
Línea de trabajo
Empieza en dotCMS/src/main/java/com/dotmarketing/portlets/categories/business/CategoryAPIImpl.java, en removeAllChildren, alrededor de la línea 794; después, sigue las llamadas desde CategoriesResource y CategoryAjax. Revisa las pruebas de integración de la API de categorías y añade cobertura para un hijo que el usuario no pueda eliminar; se considera terminado cuando ese hijo se devuelve como omitido, se procesan los hijos restantes y la importación de reemplazo y el comportamiento de eliminación heredado cumplen los criterios de aceptación.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Java
- Estrellas
- 972
- Forks
- 489
- Merge medio
- 2 d 15 h
- PR fusionados (30 d)
- 199
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotCMS/core
-
Escape the Binary field hint in the legacy content editor so an apostrophe doesn't break the fieldAbiertoOKR : Customer Support Team : Maintenance Type : Defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 2 días
-
dotCMS : Permissions OKR : Customer Support Team : Maintenance Type : Defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
dotCMS : UVE OKR : Customer Support Team : Maintenance Type : Defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
dotCMS/core#38260 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Enable the Add to Bundle action in the Pages portlet row menu (hard-coded disabled since PR 34715)AbiertodotCMS : Push Publishing OKR : Customer Support Team : Maintenance Type : Defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 2 días
-
[TASK] Postman and Karate test stacks sleep 3 s after every writePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. AbiertoTeam : Platform Type : Test Automation
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
dotCMS/core#38225 · 1 comentario ·
Los mantenedores suelen responder en 2 días
Todos los issues de dotCMS/core
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
documentation good first issue priority: low
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
Gautam-aman/CODOVYN#52 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
ControlSystemStudio/phoebus#3998 ·
Los mantenedores suelen responder en 1 día
-
bug/错误
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
FCL-Team/FoldCraftLauncher#1982 · 2 comentarios ·
Los mantenedores suelen responder en 1 día