Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Securing Odata with permissions #1735


User avatar
0
moustafa created

Hello everyone

i implement Odata against patient table and add the attribute [AbpApiAuthorize] to secure it to authenticated users , then tried to secure it to users how have the permissions on patient table by add attribute [AbpAuthorize(AppPermissions.Pages_Patient)] but unfortunately it didn't work how can i achieve that because not all authenticated users have the permissions to access such an information like that

PatientsController.cs

[AbpApiAuthorize]
    [AbpAuthorize(AppPermissions.Pages_Patient)]
    public class PatientsController : AbpODataEntityController<Patient, long>
    {
        private readonly IRepository<Patient, long> _repository;
        public PatientsController(IRepository<Patient, long> repository)
            : base(repository)
        {
            _repository = repository;
        }
    }

1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Instead of

    [AbpApiAuthorize]
        [AbpAuthorize(AppPermissions.Pages_Patient)]
    

    Just write this:

    [AbpApiAuthorize(AppPermissions.Pages_Patient)]