Hello,
I am trying to change a website from Single Tenant Single Database to MultiTenant Single Database.
I change the const to:
public const bool MultiTenancyEnabled = true;
I added TenantId to my entities and added the DbContext for each entity:
modelBuilder.Entity<InventoryAllocation>(i => { i.HasIndex(e => new { e.TenantId }); });
I ran the migration script and updated the database.
When I go into Swagger log in as Default tenant with my admin user, and I use CreateTenant, I get:
{ "result": null, "targetUrl": null, "success": false, "error": { "code": 0, "message": "Required permissions are not granted. At least one of these permissions must be granted: Creating new tenant", "details": null, "validationErrors": null }, "unAuthorizedRequest": true, "__abp": true }
When I edit my admin user in user management and click permissions I don't see CreateTenant as a permission.
How can I create a tenant?
5 Answer(s)
-
0
I just manually inserted a Tenant into the DB table directly.
-
0
Hi @mittera
Did you configure the permissions before creating the tenant with the host user? In the
AppAuthorizationProvider
class, as shown in the screenshot below, are there permissions related to the tenant? -
0
Hi @mittera
Did you configure the permissions before creating the tenant with the host user? In the
AppAuthorizationProvider
class, as shown in the screenshot below, are there permissions related to the tenant?I am running on my localhost against our dev database. I can't seem to login as the host admin.
admin@aspnetzero.comI get invalid username / password. I changed my account password then I copied the password hash from that to the host admin but still can't login.
-
0
Hi @mittera
Can you verify the value assigned to the tenancyName parameter in the
LoginAsync
method of theLogInManager
? For Angular projects, this is checked within theGetLoginResultAsync
method insideTokenAuthController
. For MVC projects, it is checked in theAccountController
.When attempting to log in as a host user, the tenancyName value should be null.
-
0
Hi @mittera
Can you verify the value assigned to the tenancyName parameter in the
LoginAsync
method of theLogInManager
? For Angular projects, this is checked within theGetLoginResultAsync
method insideTokenAuthController
. For MVC projects, it is checked in theAccountController
.When attempting to log in as a host user, the tenancyName value should be null.
Thanks that was helpful. I was able to login and create a tenant. This can be closed.