0 Replies - 295 Views - Last Post: 28 September 2018 - 01:10 PM

#1 Coding in the name of   User is offline

  • D.I.C Regular

Reputation: 67
  • View blog
  • Posts: 294
  • Joined: 07-July 10

Different application user classes, different user managers?

Posted 28 September 2018 - 01:09 PM

I have a website which has a default area for the public to use and register accounts. It also has an admin area which includes a controller for managing the accounts of other admin users, but not public ones. So I have derived two classes from ApplicationUser: PublicUser and AdminUser. I have changed the AccountController which is available to the public area to create PublicUser objects when registering instead of ApplicationUser objects. I have another controller (UsersController) in the admin area to administrate admin accounts.

My question is: Should I create an AdminUserManager class that derives from UserManager<AdminUser> like I already have an ApplicationUserManager which derives from UserManager<ApplicationUser> which I would use in UsersController to control only the admin accounts? And should I configure the app to create one of these per OWIN context, as in this line from Startup.Auth.cs: app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);? Or would this be an error?

Thank you.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1