[Bug]: Resource manager causes error 500

オープン
#7,604 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
54/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
csharp
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
C#
スター
1.1k
フォーク
791
平均マージ
5日 7時間
マージ済み PR(30日)
29

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

dnnsoftware/Dnn.Platform のほかの issue

dnnsoftware/Dnn.Platform の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。