Starts in:
1 DAY
19 HRS
25 MIN
39 SEC
Starts in:
1 D
19 H
25 M
39 S
Open Closed

ABP Not Getting Permissions On Startup #6052


User avatar
0
jordanchen98 created
  • ABP Framework version: v4.4.3
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace: Not able to get permissions on startup. Only triggers when loading Angular (http://localhost:4200)
  • Steps to reproduce the issue:
  1. Startup Monolith Architecture for ABP.io V4.4.3
  2. Does not hit breakpoint on the override Define function in Permissions.

  1. When ng serve Angular, and load up http://localhost:4200, it will then hit the breakpoint.

Is there any way to get permissions on startup instead of waiting to serve the angular to define the permissions?

I have another project running the latest ABP.io V7.4.0 and noticed that it will hit on startup. What are the differences?

Thanks, Jordan


7 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can call the IPermissionDefinitionManager.GetGroupsAsync on the OnApplicationInitialization.

    https://github.com/abpframework/abp/blob/0542f715aacac98d1723a146b26aaa64f7f283d7/framework/src/Volo.Abp.Authorization.Abstractions/Volo/Abp/Authorization/Permissions/IPermissionDefinitionManager.cs#L14

    I have another project running the latest ABP.io V7.4.0 and noticed that it will hit on startup. What are the differences?

    Because we introduced dynamic permissions, it will be loaded when the application starts

  • User Avatar
    0
    jordanchen98 created

    Hi,

    Thanks for the prompt reply. Does that mean if I do call this IPermissionDefinitionManager.GetGroupsAsync it will follow the latest version and load when the application starts?

    Thanks

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can give it a try.

  • User Avatar
    0
    jordanchen98 created

    Hi,

    Do I have to use any app to use the iPermissionDefinitionManager?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Try

    AsyncHelper.RunSync(() => app.ApplicationServices.GetRequiredService<IPermissionDefinitionManager>().GetGroupsAsync());

  • User Avatar
    0
    jordanchen98 created

    Okay will try it out! Thanks!

    Seems like GetGroupsAsync() in v4.3.0 is only GetGroups()

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    ok

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06