我收到错误消息:
未授予所需的权限。必须至少授予以下权限之一:[Plug entity]
还请就如何授予权限提出建议。
这是我的代码:
namespace Sprint.Plug
{
[AbpAuthorize(PermissionNames.Pages_PlugEntity)]
public class PlugAppService: AsyncCrudAppService<PlugEntity, PlugDto, Guid>, IPlugAppService
{
public PlugAppService(IRepository<PlugEntity,Guid> repository):base(repository)
{
}
}
}
namespace Sprint.Authorization
{
public static class PermissionNames
{
public const string Pages_Tenants = "Pages.Tenants";
public const string Pages_Users = "Pages.Users";
public const string Pages_Roles = "Pages.Roles";
public const string Pages_PlugEntity = "Pages.PlugEntity";
}
}
namespace Sprint.Authorization
{
public class SprintAuthorizationProvider : AuthorizationProvider
{
public override void SetPermissions(IPermissionDefinitionContext context)
{
context.CreatePermission(PermissionNames.Pages_Users, L("Users"));
context.CreatePermission(PermissionNames.Pages_Roles, L("Roles"));
context.CreatePermission(PermissionNames.Pages_Tenants, L("Tenants"), multiTenancySides: MultiTenancySides.Host);
context.CreatePermission(PermissionNames.Pages_PlugEntity, L("PlugEntity"), multiTenancySides: MultiTenancySides.Tenant);
}
private static ILocalizableString L(string name)
{
return new LocalizableString(name, SprintConsts.LocalizationSourceName);
}
}
}