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

How to Reorder Role Permissions in Modal? #3414


User avatar
0
OutdoorEd created

Using NetZero 3.0 MVC Jquery version. I have my applications Role Permissions set up and working properly. When you go into the Permissions Modal all of the Permissions are sorted alphabetically by the 'highest parent.'

Is it possible to do more than 2 levels of nesting? I want to have a "dummy" permission called Configuration that holds the Permission for other Views. I have Configuration showing up but I can't get the proper 'children' underneath it because of the default alpha sort. Below is what I want to do with my dummy Configuration permission and the second and third levels I am trying to use. Below that is an example of the normal two-level permission

[ ]Configuration - Level 1 [ ] Notification - Level 2 [ ] Create Notification - Level 3 [ ] Edit Notification - Level 3 [ ] Person Notified - Level 2 [ ] Create Person - Level 3 [ ] Edit Person - Level 3 [ ]Department - Level 1 [ ] Create Department - Level 2 [ ] Edit Department - Level 2


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

    Hi,

    Can you share how do you define permissions on the server side for this ?

    Thanks.

  • User Avatar
    0
    OutdoorEd created

    Here are my files. I am running my app in a separate Area - \Areas\Incidents\

    AppPermissions.cs

    public const string Pages_Configuration = "Pages.Configuration";

        //PersonNotified Menu
        public const string Pages_PersonNotified = "Pages.PersonNotified";
        public const string Pages_PersonNotified_Index = "Pages.PersonNotified.Index";
        public const string Pages_PersonNotified_Create = "Pages.PersonNotified.Create";
        public const string Pages_PersonNotified_Delete = "Pages.PersonNotified.Delete";
        public const string Pages_PersonNotified_Details = "Pages.PersonNotified.Details";
        public const string Pages_PersonNotified_Edit = "Pages.PersonNotified.Edit";
    

    AppAuthorizationProvider.cs

    //Configuration var configuration = pages.CreateChildPermission(AppPermissions.Pages_Configuration, L("Configuration"));

            //PersonNotified
            var personnotified = pages.CreateChildPermission(AppPermissions.Pages_PersonNotified, L("PersonNotified"));
            personnotified.CreateChildPermission(AppPermissions.Pages_PersonNotified_Index, L("IndexPersonNotified"));
            personnotified.CreateChildPermission(AppPermissions.Pages_PersonNotified_Create, L("CreatePersonNotified"));
            personnotified.CreateChildPermission(AppPermissions.Pages_PersonNotified_Delete, L("DeletePersonNotified"));
            personnotified.CreateChildPermission(AppPermissions.Pages_PersonNotified_Details, L("DetailsPersonNotified"));
            personnotified.CreateChildPermission(AppPermissions.Pages_PersonNotified_Edit, L("EditPersonNotified"));
    

    OE_Tenant.xml

    <text name="Configuration" value="Configuration" /> <text name="PersonNotified" value="Person Notified" />

    &lt;text name=&quot;IndexPersonNotified&quot; value=&quot;List&quot; /&gt;
    &lt;text name=&quot;CreatePersonNotified&quot; value=&quot;Add&quot; /&gt;
    &lt;text name=&quot;DeletePersonNotified&quot; value=&quot;Delete&quot; /&gt;
    &lt;text name=&quot;DetailsPersonNotified&quot; value=&quot;Details&quot; /&gt;
    &lt;text name=&quot;EditPersonNotified&quot; value=&quot;Edit&quot; /&gt;
    

    PageNames.cs

    public const string Configuration = "Configuration"; public const string PersonNotified = "Configuration.PersonNotified";

    IncidentNavigationProvider - used as in a separate Area from Mpa called Incidents

    //CONFIGURATION .AddItem(new MenuItemDefinition( PageNames.App.Incidents.Configuration, L("Configuration"), icon: "fa fa-flag", requiredPermissionName: AppPermissions.Pages_Configuration )

                //Person Notified
              .AddItem(new MenuItemDefinition(
                        PageNames.App.Incidents.PersonNotified, L("PersonNotified"),
                        icon: "fa fa-sitemap",
                        requiredPermissionName: AppPermissions.Pages_PersonNotified
                        )
    
                    .AddItem(new MenuItemDefinition(
                        PageNames.App.Incidents.PersonNotified, L("IndexPersonNotified"),
                        url: "Incidents/PersonNotified/Index", 
                        icon: "fa fa-list",
                        requiredPermissionName: AppPermissions.Pages_PersonNotified_Index))
    
                    .AddItem(new MenuItemDefinition(
                        PageNames.App.Incidents.PersonNotified, L("CreatePersonNotified"),
                        url: "Incidents/PersonNotified/Create", 
                        icon: "fa fa-plus-square-o",
                        requiredPermissionName: AppPermissions.Pages_PersonNotified_Create))
                )
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    If I don't understand your question wrong, below definition should add 2 level of permisisons, have you tried it ?

    //Configuration
    var configuration = pages.CreateChildPermission(AppPermissions.Pages_Configuration, L("Configuration"));
    
    //PersonNotified
    var personnotified = configuration.CreateChildPermission(AppPermissions.Pages_PersonNotified, L("PersonNotified"));
    personnotified.CreateChildPermission(AppPermissions.Pages_PersonNotified_Index, L("IndexPersonNotified"));
    ...
    

    Thanks.

  • User Avatar
    0
    OutdoorEd created

    That is not my question. I already followed this post to get the 3 level menus -https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=745&p=9800&hilit=three+level+menu#p9800

    What I need to do is manage the sorting of the Permissions. So when you click on Users/Permissions the Modal Window pops up and shows all of the menu items with Check boxes for Permissions set. By default all menu items are sorted Alpha but I need to set my own custom order.

    The default is

    Admin Home Page Audit Log Languages

    How would I change the display order to

    Languages Audit Log Admin Home Page

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @OutdoorEd,

    Sorry, it is my mistake. You can change sorting here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Web/Areas/Mpa/Views/Common/_PermissionTree.cshtml#L5">https://github.com/aspnetzero/aspnet-ze ... .cshtml#L5</a>.

    Thanks.