Search code examples
c#asp.net-mvcaspnetboilerplate

Abp Tenant creation not working. AbpAuthorizationException at CreateStaticRoles


After update to Abp 2.3 my tenant creation is not working anymore.

The exception is been throwing when the roles are created:

//TenantAppService.cs

//We are working entities of new tenant, so changing tenant filter
            using (CurrentUnitOfWork.SetTenantId(tenant.Id))
            {
                //Create static roles for new tenant
                CheckErrors(await _roleManager.CreateStaticRoles(tenant.Id)); <-- Here

The exception:

Exception thrown: 'Abp.Authorization.AbpAuthorizationException' in 
mscorlib.dll

Additional information: [At least one of these permissions must be granted]

I didn't change the TenantAppService that came from Module Zero, but if I remove the AbpAuthorize from class it works.

    [AbpAuthorize(PermissionNames.Pages_Tenants)] //If removed works
    public class TenantAppService : SeducaAppServiceBase, ITenantAppService
    {
    ...

Tks.


Solution

  • The problem was AbpCache.

    What I need to do is restart the app (cleaning everything) or call the api method (api/AbpCache/ClearAll)

    reference: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/573

    It's solves all my problems with permissions