Open Closed

identity management permissions #4841


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: NA
  • Steps to reproduce the issue:"NA

We have to enable below permission for role but don't want menu (administration --> identity management --> users) to be displayed in web UI. How we can achieve it. Identity management --> user management --> create/Edit permission


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

    Hi,

    Sorry, but can you explant it in detail? thanks

  • User Avatar
    0
    shobhit created
    1. When below permission provided (we wants only Edit Permission)
    2. In UI Following menu section displayed
    3. What we want: Only Edit permission should be enabled so that menu is not visible
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can the following code to your MenuContributor

    var identity = context.Menu.GetAdministration().GetMenuItem(IdentityMenuNames.GroupName);
    identity.GetMenuItem(IdentityMenuNames.Users).RequirePermissions(IdentityPermissions.Users.Delete, IdentityPermissions.Users.Create);
    
  • User Avatar
    0
    shobhit created

    Do i have to modify this class or i am looking at wrong place.

  • User Avatar
    0
    shobhit created

    If this is the righ place to modify code i am getting error in

    identity.GetMenuItem("Users").RequirePermissions(IdentityPermissions.Users.Delete, IdentityPermissions.Users.Create);

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Sorry, I just realized you are using angular UI.

    You can check the document to patch a menu: https://docs.abp.io/en/abp/4.2/UI/Angular/Modifying-the-Menu#how-to-patch-or-remove-a-navigation-element

    const newIdentityUserRouteConfig: Partial<ABP.Route> = {
      parentName: eIdentityRouteNames.IdentityManagement,
      requiredPolicy: 'permission key here',
    };
    
    this.routes.patch(eIdentityRouteNames.Users, newIdentityUserRouteConfig);
    
  • User Avatar
    0
    shobhit created

    How we can add multiple policies. is it comma seperated and will it consider "and" or "or" condition for permissions?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    How we can add multiple policies. is it comma seperated and will it consider "and" or "or" condition for permissions?

    Unfortunately not.

  • User Avatar
    0
    shobhit created

    Oh Ok. So it will consider only 1 policy?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    The route has a property invisible, you can check the permissions manually.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11