Search code examples
asp.net-coreaspnetboilerplateabp-framework

I am trying to implement Permisions in asp.net boilerplate webApi


I am trying to implement an AppService called Plug, I want to use User Role and Permissions and I can't seem to get it working, I applied the steps above and I am not winning.

namespace Sprint.Plug
{
    [AbpAuthorize(PermissionNames.Pages_PlugEntity)] //Permisions
    public class PlugAppService: AsyncCrudAppService<PlugEntity, PlugDto, Guid>, IPlugAppService
     {        
       public PlugAppService(IRepository<PlugEntity,Guid> repository):base(repository)
       {

       }        
   }
 }   

Solution

  • Have you applied the permission to the database for your user/role in AbpPermissions table? if you are already authenticated and you consume that API, [AbpAuthorize(PermissionNames.Pages_PlugEntity)] attribute will check you have permission in table AbpPermissions isgranted or not.

    Ex : enter image description here