role code error fixed
This commit is contained in:
@@ -187,8 +187,12 @@ public sealed class RoleService : IRoleService
|
|||||||
if (string.IsNullOrWhiteSpace(roleCode))
|
if (string.IsNullOrWhiteSpace(roleCode))
|
||||||
return new MeResponseDto(null, null, Array.Empty<string>());
|
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()
|
var role = await _roles.Query().AsNoTracking()
|
||||||
.FirstOrDefaultAsync(r => r.Code == roleCode, ct);
|
.FirstOrDefaultAsync(r => r.Code.ToLower() == normalized.ToLower(), ct);
|
||||||
if (role is null)
|
if (role is null)
|
||||||
return new MeResponseDto(roleCode, null, Array.Empty<string>());
|
return new MeResponseDto(roleCode, null, Array.Empty<string>());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user