Base solution for your next web application
Open Closed

Cannot authorized by calling API #2885


User avatar
0
billytsoi created

Hi all

I use the CallApiFromConsole solution to try calling my WebApi layer.

I am able to get the new token, but when i call AppService layer method, i get the " There is no permission with name: Advisorys.MarketManagement" on both log and AbpAuditLogs table.

I have setup the permission

public class FeedServiceAuthorizationProvider : AuthorizationProvider { public override void SetPermissions(IPermissionDefinitionContext context) {

        var advisory = context.CreatePermission("Advisory");
        var clientManagement = advisory.CreateChildPermission("Advisory.ClientManagement");
        var marketManagement = advisory.CreateChildPermission("Advisory.MarketManagement");

  ....

And i have manually input the data on tables

select * from AbpRoles select * from AbpUserRoles select * from AbpPermissions

May i know what's the problem i can be? Do i need to explicitly grant these Static Role?

Please help

Log example: UG 2017-04-07 16:22:51,125 [31 ] Abp.Web.SignalR.Hubs.AbpCommonHub - A client is reconnected: {"ConnectionId":"2b29dbee-6956-43c3-acf0-b206d9c15101","IpAddress":"::1","TenantId":1,"UserId":5,"ConnectTime":"2017-04-07T16:19:43.0021683+08:00","Properties":{}} ERROR 2017-04-07 16:23:21,507 [21 ] nHandling.AbpApiExceptionFilterAttribute - There is no permission with name: Advisorys.MarketManagement Abp.AbpException: There is no permission with name: Advisorys.MarketManagement at Abp.Authorization.PermissionManager.GetPermission(String name) in D:\Github\aspnetboilerplate\src\Abp\Authorization\PermissionManager.cs:line 55 at Abp.Authorization.Users.AbpUserManager`2.


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

    Hi,

    Do you use any caching mechanism ? Permissions might be cached.

    Thanks.