Base solution for your next web application
Open Closed

Create new tenant and admin user #185


User avatar
0
jaq316 created

How would one go about registering a new tenant and an admin user for the newly created tenant in the same application service?

The idea is to have a registration form that will allow new users to choose a tenancy name (subdomain) and enter the admin username and password to be used as the admin user for the new tenant.


3 Answer(s)
  • User Avatar
    0
    codemonkey21 created

    To me, this seems more of a conceptual question than a technical question. I'll explain how in my project, I plan on attempting to tackle this since I'm doing something similar.

    My project is sort of local reviews, with a twist. I plan on having regular users (no concept of tenancy) and business owners. Business owners will register, then create a business account (new tenant with subdomain). Since they are the original registrant of that tenancy, they become the account owner / admin for that tenant by default. They can then invite additional employees to join that tenancy and assign various business roles to manage the venues they own.

    BusinessUser extends my User class, as it will have various additional properties. Business is really just Tenant. Will have various additional properties. Create a BusinessUserAppService for BusinessUsers. Create a UserAppService for Users. Use two different login forms; one for regular users and one for business users that point to the appropriate Controller / App Service.

    So for what you're asking, I don't see this as being completely in one application service. I would use both a TenantAppService and a UserAppService. First I would check for an existing tenant of the same name and if the user exists, if either doesn't exist, create the tenant and add the new user to it.

    Just my interpretation of it.

  • User Avatar
    0
    hikalkan created
    Support Team

    This is the 'create tenant' dialog in AspNet Zero (<a class="postlink" href="http://www.aspnetzero.com/">http://www.aspnetzero.com/</a>):

    [attachment=0:kusqam1i]create-tenant.png[/attachment:kusqam1i]

    I create tenant, static roles of the tenant, admin user of the tenant (and assign admin role to the admin user) in one service call.

  • User Avatar
    0
    xumx created

    I have this exact same problem. The public registration of Tenant means that the request has no permissions attached. I don't know how to "static roles of the tenant, admin user of the tenant (and assign admin role to the admin user) in one service call." when the RoleManager and UserManager are not resolved properly.

    What is the best way to implement public registration of new Tenants?