Ejemplo n.º 1
0
		public AccountController()
			: this(new ULearnUserManager())
		{
			db = new ULearnDb();
			courseManager = WebCourseManager.Instance;
			usersRepo = new UsersRepo(db);
			userRolesRepo = new UserRolesRepo(db);
			groupsRepo = new GroupsRepo(db);
			certificatesRepo = new CertificatesRepo(db);
			visitsRepo = new VisitsRepo(db);
		}
Ejemplo n.º 2
0
		public AccountController()
			: this(new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ULearnDb())))
		{
			db = new ULearnDb();
			courseManager = WebCourseManager.Instance;
			userManager.UserValidator =
				new UserValidator<ApplicationUser>(userManager)
				{
					AllowOnlyAlphanumericUserNames = false
				};
			usersRepo = new UsersRepo(db);
			userRolesRepo = new UserRolesRepo(db);
		}
Ejemplo n.º 3
0
		public UsersRepo(ULearnDb db)
		{
			this.db = db;
			userRolesRepo = new UserRolesRepo(db);
		}
Ejemplo n.º 4
0
		public static async Task<ClaimsIdentity> GenerateUserIdentityAsync(this ApplicationUser user, UserManager<ApplicationUser> manager)
		{
			var userRoles = new UserRolesRepo();
			return await user.GenerateUserIdentityAsync(manager, userRoles);
		}
Ejemplo n.º 5
0
		public static async Task<ClaimsIdentity> GenerateUserIdentityAsync(this ApplicationUser user, UserManager<ApplicationUser> manager, UserRolesRepo userRoles)
		{
			var identity = await manager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
			identity.AddCourseRoles(userRoles.GetRoles(user.Id));
			return identity;
		}
Ejemplo n.º 6
0
 public UsersRepo(ULearnDb db)
 {
     this.db       = db;
     userRolesRepo = new UserRolesRepo(db);
 }