Base solution for your next web application
Open Closed

Abp.AbpException: There is no user with id #38


User avatar
0
dinhienhy created

Hi all,

I tried to use AbpPermissions with attribute for controller:

[AbpAuthorize(Permissions= new String[]{"CanSetting"})]

But it throw an Abp.AbpException: There is no user with id. Please review my database in attachment image.

Please give me some advice to configuration permision.

Thanks,


4 Answer(s)
  • User Avatar
    0
    apexdodge created

    I'm getting the same error. Can't seem to figure this one out.

  • User Avatar
    0
    apexdodge created

    I figured out the issue -- we need to have at least 1 tenant.

    When I had the issue, I was getting No Results even on a simple _userRepository.GetAllList() which made no sense since I had multiple users in that table.

    I went ahead and created a single Tenant in the tenant table with Id = 1 and now I'm setting all my Users to have TenantId = 1.

    Worked after that.

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Sorry for that since it's not documented yet. But you found the case. There should be a default tenant with Id = 1. If the application is not multi-tenant, it's assumed as single-tenant. So, there should be a single tenant.

  • User Avatar
    0
    dinhienhy created

    @apexdodge and @hikalkan Thanks for your help. I will set default tenant to 1 for all role and user.