[Bug]: Resource manager causes error 500

Abierto
#7,604 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
54/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
csharp
Área
backend

Línea de trabajo

Start with the Resource Manager /API/ResourceManager/Items/GetRoles path and compare its role lookup and caching behavior with the fix in issue #6133 for the Persona Bar and PermissionsGrid. Trace how localized role names reach the roles cache and AdvancedPermissionProvider.GetOrCreateAdvancedRole; done means localized role names no longer corrupt role lookups or cause page requests to return HTTP 500.

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

Descripción

Status: New
Is there an existing issue for this?
  • I have searched the existing issues
What happened?

On a site whose UI culture localizes role names (fr-FR : GlobalResources.fr-FR.resx ships Content Editors.Role = "Éditeurs de contenu"), the whole site starts returning HTTP 500 on every page, anonymous visitors included, and only an app pool recycle brings it back.

The same issue was fixed for the Persona Bar and PermissionsGrid in #6133 ("Fixes to avoid RoleName localization bleeding into the roles cache"), but the Resource Manager was not covered. Other code that looks a role up by name is affected too, e.g. GetRoleByName(portalId, "Administrators") returns null while the cache is corrupted.

Steps to reproduce?
  1. DNN 10.3.3, portal with fr-FR enabled (default GlobalResources.fr-FR.resx, which contains Content Editors.Role).
  2. Log in as an administrator with the UI in French.
  3. Open the Resource Manager and try to modify a folder name (role names are displayed localized on second tab), then save.
  4. Browse any page of the site.

Confirmed in production: the IIS logs show a call to /API/ResourceManager/Items/GetRoles just before the first 500.

Current Behavior

Every page returns 500 until the app pool is recycled (some users already logged may see part of the content with 500 errors on modules):

System.ArgumentException: System.Data.SqlClient.SqlException (0x80131904): Violation of UNIQUE KEY constraint 'IX_RoleName'. Cannot insert duplicate key in object 'dbo.Roles'. The duplicate key value is (0, Content Editors).
   at DotNetNuke.Security.Roles.DNNRoleProvider.CreateRole(RoleInfo role)
   at DotNetNuke.Security.Roles.RoleController.DotNetNuke.Security.Roles.IRoleController.AddRole(RoleInfo role, Boolean addToExistUsers)
   at DotNetNuke.Security.Permissions.AdvancedPermissionProvider.GetOrCreateAdvancedRole(Int32 portalId, String roleName)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at DotNetNuke.Security.Permissions.AdvancedPermissionProvider.GenerateVirtualPermissions(List`1 permissions, Int32 portalId, IEnumerable`1 possiblePermissions)
   at DotNetNuke.Security.Permissions.AdvancedPermissionProvider.GenerateVirtualTabPermissions(List`1 permissions, Int32 portalId, Int32 tabId)
   at DotNetNuke.Security.Permissions.AdvancedPermissionProvider.GetTabPermissions(Int32 tabId, Int32 portalId)
   at DotNetNuke.Entities.Tabs.TabInfo.get_TabPermissions()
   at DotNetNuke.Security.Permissions.AdvancedPermissionProvider.CanDoOnPage(TabInfo tab, String exactKey)
   at DotNetNuke.Security.Permissions.AdvancedPermissionProvider.CanViewPage(TabInfo tab)
   at DotNetNuke.UI.Skins.Skin.ProcessMasterModules()
   at DotNetNuke.UI.Skins.Skin.OnInit(EventArgs e)
Expected Behavior

Displaying role names in other languages shouldn't cause 500 errors.

Relevant log output
See stacktrace above.
Anything else?

Workaround: remove Content Editors.Role and Content Managers.Role from the GlobalResources.<culture>.resx files. Those roles then show untranslated, and the keys come back with the next upgrade or language pack.

Affected Versions

10.4.1 (latest release)

What browsers are you seeing the problem on?

No response

Code of Conduct
  • I agree to follow this project's Code of Conduct
Lenguaje dominante
C#
Estrellas
1.1k
Forks
791
Merge medio
5 d 7 h
PR fusionados (30 d)
29

Preparar el entorno

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 dnnsoftware/Dnn.Platform

Todos los issues de dnnsoftware/Dnn.Platform

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.