Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Edit Tool Group dialog shows "already exists" message for every save error

Abierto Apto para principiantes
#38,357 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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
82/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java, javascript
Área
backend, frontend

Línea de trabajo

Empieza en dotCMS/src/main/webapp/html/portlet/ext/roleadmin/view_roles_js_inc.jsp en saveLayoutException y luego sigue dónde se usa el manejador en addNewLayout. Comprueba cómo se pasa el error del servidor al manejador y cómo se identifica el conflicto de nombres existente. El trabajo estará terminado cuando ambas rutas de guardado muestren el conflicto de nombres solo para esa excepción, se muestren los demás errores del servidor y un guardado correcto siga cerrando el diálogo y mostrando el mensaje de guardado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

dotCMS : Permissions OKR : Customer Support Team : Maintenance Type : Defect
Problem Statement

In System > Roles & Tools > Tools, the Edit Tool Group dialog shows "Another Tool Group already exists in the system with the same name" (another-layout-already-exists) for every error that happens on Save, not only when the name is taken.

The cause is in saveLayoutException in dotCMS/src/main/webapp/html/portlet/ext/roleadmin/view_roles_js_inc.jsp:

function saveLayoutException(message, exception) {
    if(exception.javaClassName = 'com.dotmarketing.business.LayoutNameAlreadyExistsException') {
        dojo.byId('addLayoutErrorMessagesList').innerHTML = anotherLayoutAlreadyExistsMsg
        return;
    }
}

The condition uses = (assignment) instead of === (comparison), so it is always true and the real error is never shown.

This became easier to hit after https://github.com/dotCMS/core/pull/36345, which made RoleAjax.updateLayout require a CMS Administrator. A back-end user who can open Roles & Tools but is not a CMS Administrator can still open the dialog and click Save. The server correctly refuses with "User does not have permission to update layouts", but the dialog tells them the name is taken. They then try other names, when the real answer is that they are not allowed. Any other server error on Save (a database error, for example) is hidden the same way.

Impact: wrong message only. The server-side check works and nothing is saved.

Steps to Reproduce
  1. As a CMS Administrator, create a back-end user and a custom tool group that holds the Roles & Tools and Users portlets. Assign that tool group to the user's personal role.
  2. Create a second custom tool group, for example Test-Group, holding any portlet.
  3. Log in as the back-end user and go to System > Roles & Tools > Tools.
  4. Click Test-Group to open the Edit Tool Group dialog, change the name to Test-Group-Renamed and click Save.

Expected: the dialog shows the server's error: "User does not have permission to update layouts".
Actual: the dialog shows "Another Tool Group already exists in the system with the same name", although no group has that name. The group is not changed (correct).

Acceptance Criteria
  • When Save fails because the name is already used by another tool group, the dialog still shows "Another Tool Group already exists in the system with the same name".
  • When Save fails for any other reason (for example the permission refusal above), the dialog shows the error message returned by the server instead of the "name already exists" text.
  • Creating a new tool group (addNewLayout) uses the same handler and follows the same two rules.
  • A successful save by a CMS Administrator still closes the dialog and shows the "saved" message.
dotCMS Version

Seen on main (image dotcms/dotcms:trunk_16df8bd). The faulty check is older than that build.

Severity

Low - Minor issue or cosmetic

Links

NA

Lenguaje dominante
Java
Estrellas
972
Forks
489
Merge medio
2 d 15 h
PR fusionados (30 d)
206

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de dotCMS/core

Todos los issues de dotCMS/core

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.