Version Update Modal Rework + A few bugfixes (#3664)
This commit is contained in:
parent
9fb3bdd548
commit
43d0d1277f
65 changed files with 1963 additions and 805 deletions
|
@ -546,7 +546,16 @@ public class UserRepository : IUserRepository
|
|||
public async Task<IList<string>> GetRoles(int userId)
|
||||
{
|
||||
var user = await _context.Users.FirstOrDefaultAsync(u => u.Id == userId);
|
||||
if (user == null || _userManager == null) return ArraySegment<string>.Empty; // userManager is null on Unit Tests only
|
||||
if (user == null) return ArraySegment<string>.Empty;
|
||||
|
||||
if (_userManager == null)
|
||||
{
|
||||
// userManager is null on Unit Tests only
|
||||
return await _context.UserRoles
|
||||
.Where(ur => ur.UserId == userId)
|
||||
.Select(ur => ur.Role.Name)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
return await _userManager.GetRolesAsync(user);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue