mo-esmp / DynamicRoleBasedAuthorizationNETCore

Dynamic Role-Based Access Control for ASP.NET Core MVC and Web API
GNU General Public License v3.0
451 stars 94 forks source link

Fix null Actions when creating Role #4

Closed mubassir-hasan closed 5 years ago

mubassir-hasan commented 5 years ago

In Role>Create view this code need to be fixed. it's causing null Actions in Post Edit From

 @if (controller.Actions.Any())
                                {
                                    <ol>
                                        @foreach (var action in controller.Actions)
                                        {
                                            name = action.DisplayName ?? action.Name;
                                            <li data-value="@action.Name">@name</li>
                                        }
                                    </ol>
                                }

To

 @if (controller.Actions.Any())
                                {
                                    <ul>
                                        @foreach (var action in controller.Actions)
                                        {
                                            name = action.DisplayName ?? action.Name;
                                            <li data-value="@action.Name">@name</li>
                                        }
                                    </ul>
                                }
mo-esmp commented 5 years ago

Are you sure about this ? I haven't seen any difference between the codes you posted. Could please tell me how to reproduce this exception ?

mubassir-hasan commented 5 years ago

In javascript selector $('ul > li > input[type="checkbox"]:checked', $(controller).parent()).each(function () { But in html you are defining


                                 <ol>
                                        @foreach (var action in controller.Actions)
                                        {
                                            name = action.DisplayName ?? action.Name;
                                            <li data-value="@action.Name">@name</li>
                                        }
                                  </ol>

ol sould be ul because of this in Role create post alawys null actions

mo-esmp commented 5 years ago

Issue fixed, thank you.