Another ACL bug.

This commit is contained in:
Michael 2017-03-21 13:07:03 -04:00
parent 4654aaea6b
commit bf85c3cda2

View file

@ -46,9 +46,15 @@ public static IHtmlString UserName(this HtmlHelper hpr, string userId)
{
userRoles.Add(db.Roles.FirstOrDefault(r => r.Id == usrRole.RoleId) as Role);
}
var userRole = userRoles.OrderByDescending(m => m.Priority).First();
return hpr.Raw($@"<strong style=""color:{userRole.ColorHex}"">{hpr.Encode(usr.DisplayName)}</strong>");
var userRole = userRoles.OrderByDescending(m => m.Priority).FirstOrDefault();
if (userRole == null)
{
return hpr.Raw($@"<strong>{hpr.Encode(usr.DisplayName)}</strong>");
}
else
{
return hpr.Raw($@"<strong style=""color:{userRole.ColorHex}"">{hpr.Encode(usr.DisplayName)}</strong>");
}
}
}