role code error fixed

This commit is contained in:
2026-07-22 16:14:49 +05:30
parent 9260b4de9b
commit 5cf9588728
+5 -1
View File
@@ -187,8 +187,12 @@ public sealed class RoleService : IRoleService
if (string.IsNullOrWhiteSpace(roleCode))
return new MeResponseDto(null, null, Array.Empty<string>());
// AuthHex mints the RoleCode claim independently of ERPCore's stored casing
// (e.g. token "ADMIN" vs seeded "Admin"), so match case-insensitively — an
// identity code differing only by case must not lock the user out of the nav.
var normalized = roleCode.Trim();
var role = await _roles.Query().AsNoTracking()
.FirstOrDefaultAsync(r => r.Code == roleCode, ct);
.FirstOrDefaultAsync(r => r.Code.ToLower() == normalized.ToLower(), ct);
if (role is null)
return new MeResponseDto(roleCode, null, Array.Empty<string>());