【问题标题】:Abp Tenant creation not working. AbpAuthorizationException at CreateStaticRolesAbp 租户创建不起作用。 CreateStaticRoles 的 AbpAuthorizationException
【发布时间】:2018-02-05 02:23:34
【问题描述】:

更新到 Abp 2.3 后,我的租户创建不再起作用。

创建角色时抛出异常:

//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

例外:

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

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

我没有更改来自模块 0 的 TenantAppService,但如果我从类中删除 AbpAuthorize,它就可以工作。

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

谢谢。

【问题讨论】:

    标签: c# asp.net-mvc aspnetboilerplate


    【解决方案1】:

    问题出在 AbpCache。

    我需要做的是重启应用(清理一切)或调用api方法(api/AbpCache/ClearAll)

    参考:https://github.com/aspnetboilerplate/aspnetboilerplate/issues/573

    它解决了我所有的权限问题

    【讨论】:

      【解决方案2】:

      调用此方法的用户必须获得PermissionNames.Pages_Tenants 的权限。

      【讨论】:

      • 用户有权限,我在DB查过。事实上,如果没有,它甚至无法到达 CreateStaticRoles 方法的调用。
      猜你喜欢
      • 2022-08-24
      • 1970-01-01
      • 1970-01-01
      • 2021-11-24
      • 1970-01-01
      • 2019-09-22
      • 2019-05-16
      • 2014-10-08
      • 1970-01-01
      相关资源
      最近更新 更多