Search code examples
asp.net-coreasp.net-identityabp-framework

Create new user with new tenant in ABP Framework


I customized a new registration page in Blazor Wasm and want to create a new User with new Tenant. I wanted to use ITenantAppService.CreateAsync but it occurred permission problem.

var tenantDto = await _tenantAppService.CreateAsync(new TenantCreateDto()
            {
                Name = dto.UserName,
                AdminEmailAddress = dto.EmailAddress,
                AdminPassword = dto.Password,
            });

enter image description here

Isn't it possible to create a Tenant by anonymous user? I think I need to remove this permissions from tenantService or I need to give these permissions to anonymous user.

How can I create new tenant for new user?


Solution

  • I found solution. Firstly, I tried to remove permissions but I didn't know how to remove easily. Then I tried firstly creating a user without tenant, then give him tenant.create permission but it didn't work. Finally, I created a class

    CustomTenantAppService : TenantManagementAppServiceBase, ITenantAppService
    

    and implemented methods of ITenantAppService, so I could do everything that I want.