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

Abpsession.Use() inheriting permissions #5064


User avatar
0
michelmk2 created

Hi guys,

I'm currently using version v5.2.0.0 of ASP.Net ZERO. I'm using the AbpSession.Use(1, 3) function in my controller, however it doesn't seem to recognize the permission granted to the user with id 3 and tenantId 1. I am 100% sure the user actually does have the required permission. Is this just how it works or am I missing something?

Code in my controller:

using (AbpSession.Use(assignment.TenantId, assignment.CreatedByUserId))
                    {
                        bool isPurchased = _searchResultAppService.PurchaseAmbitionProfile(candidateAmbitionProfileApproval.CatsId, candidateAmbitionProfileApproval.AssignmentId, connectionString, candidateAmbitionProfileApproval.AssignmentCandidateId);
                    }

Code in my appservice:

public interface ISearchresultAppService : IApplicationService
    {
        bool PurchaseAmbitionProfile(int catsId, int assignmentId, string connectionString, int assignmentCandidateId);
    }

    [AbpAuthorize(AppPermissions.Pages_Assignment)]
    public class SearchresultAppService : RobinAppServiceBase, ISearchresultAppService
    {
        private readonly IRepository<tblSearchResult> _searchresultRepository;

        public SearchresultAppService(IRepository<tblSearchResult> searchresultRepository)
        {
            _searchresultRepository = searchresultRepository;
        }

        public bool PurchaseAmbitionProfile(int catsId, int assignmentId, string connectionString, int assignmentCandidateId)
        {
            return true;
        }
    }

I get an error when executing _searchResultAppService.PurchaseAmbitionProfile

The error is: Abp.Authorization.AbpAuthorizationException: 'Required permissions are not granted. At least one of these permissions must be granted: Assignment'

Am I doing something wrong here? Thanks!


7 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Show screenshot of PermissionSettings table.

  • User Avatar
    0
    michelmk2 created

    <cite>aaron: </cite> Show screenshot of PermissionSettings table.

    There you go, [https://i.imgur.com/iBsXMwt.png])

    Thanks!

  • User Avatar
    0
    ismcagdas created
    Support Team

    @michelmk2 could it be a cache issue ? How did you grant the permission to user ?

  • User Avatar
    0
    michelmk2 created

    <cite>ismcagdas: </cite> @michelmk2 could it be a cache issue ? How did you grant the permission to user ?

    I granted the permission via the Administration -> Users -> Permissions window. Do you have any suggestions I could try?

    Thanks!

  • User Avatar
    0
    ismcagdas created
    Support Team

    @michelmk2 then there might be a bug. What is your current ABP version ? If it is not the latest one, can you try with latest ABP (v3.6) ?

  • User Avatar
    0
    michelmk2 created

    <cite>ismcagdas: </cite> @michelmk2 then there might be a bug. What is your current ABP version ? If it is not the latest one, can you try with latest ABP (v3.6) ?

    Hey,

    I just upgrade to ABP version 3.6 and it still doesn't work :cry: , same error. Got any more suggestions?

    Thanks!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Can you create an issue here <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues">https://github.com/aspnetboilerplate/as ... ate/issues</a> ? We will test and fix this.