Open Closed

Get/Create Permissions for a role #4626


User avatar
0
shobhit created
  • ABP Framework version: v4.2.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hi Team, i have to get permssions assigned to a role (role1) and has to create same set of permissiones for another role (role2). How i can do it.


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can use the methods of IPermissionManager below.

    GetForRoleAsync
    GetAllForRoleAsync
    SetForRoleAsync
    

    https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/RolePermissionManagerExtensions.cs

  • User Avatar
    0
    shobhit created

    Thanks. Does GetAllForRoleAsync gives all permissions for only assigned permissions for the role?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    GetAllForRoleAsync only get permissions. the result is a List<PermissionWithGrantedProviders>

    public string Name { get; }
    
    public bool IsGranted { get; set; }
    

    https://github.com/abpframework/abp/blob/dev/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionWithGrantedProviders.cs#L6

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