public AccountController( HttpContextWrapper httpContext, HttpResponseWrapper httpResponse) { _context = httpContext; _response = httpResponse; _authenticationManager = _context.GetOwinContext().Authentication; _userManager = _context.GetOwinContext().GetUserManager<ApplicationUserManager>(); }
private static IList<Role> GetLtiRolesForUser(ApplicationUser user) { var httpContext = new HttpContextWrapper(HttpContext.Current); var roleManager = httpContext.GetOwinContext().Get<ApplicationRoleManager>(); var roles = new List<Role>(); foreach (var identityRole in user.Roles.Select(role => roleManager.FindById(role.RoleId))) { if (identityRole.Name.Equals(UserRoles.StudentRole)) roles.Add(Role.Learner); if (identityRole.Name.Equals(UserRoles.TeacherRole)) roles.Add(Role.Instructor); } return roles; }